[{"id":16982,"web_url":"https://patchwork.libcamera.org/comment/16982/","msgid":"<CAO4hSrgNa+6oOXbK=LPsdGiXOD3WM_L4V3+VuvJfhFFaWS63Gw@mail.gmail.com>","date":"2021-05-17T07:32:44","subject":"Re: [libcamera-devel] [PATCH v2] pipeline: simple: Rework the\n\tsupportedDevices list","submitter":{"id":79,"url":"https://patchwork.libcamera.org/api/people/79/","name":"Phi-bang Nguyen","email":"pnguyen@baylibre.com"},"content":"Hi Laurent,\n\nJust a friendly reminder of this patch :-)\n\nThanks !\n\nPhi-Bang\n\nOn Thu, May 6, 2021 at 8:06 PM Phi-Bang Nguyen <pnguyen@baylibre.com> wrote:\n\n> The supportedDevices may contain entries which have the same driver\n> but different converters. For example, if we add these two entries:\n>\n> { \"mtk-seninf\", \"mtk-mdp\", 3 },\n> { \"mtk-seninf\", \"mtk-mdp3\", 3 },\n>\n> the simple pipeline handler will always take the first one where it\n> can acquire the driver and skip the rest.\n>\n> So, make the changes to support this usecase.\n>\n> Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 30 +++++++++++++++---------\n>  1 file changed, 19 insertions(+), 11 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp\n> b/src/libcamera/pipeline/simple/simple.cpp\n> index f6095d38..4c87ec4c 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -127,16 +127,19 @@ class SimplePipelineHandler;\n>\n>  struct SimplePipelineInfo {\n>         const char *driver;\n> -       const char *converter;\n> -       unsigned int numStreams;\n> +       /*\n> +        * Each converter in the list contains the name\n> +        * and the number of streams it supports.\n> +        */\n> +       std::vector<std::pair<const char *, unsigned int>> converters;\n>  };\n>\n>  namespace {\n>\n>  static const SimplePipelineInfo supportedDevices[] = {\n> -       { \"imx7-csi\", \"pxp\", 1 },\n> -       { \"qcom-camss\", nullptr, 1 },\n> -       { \"sun6i-csi\", nullptr, 1 },\n> +       { \"imx7-csi\", { { \"pxp\", 1 } } },\n> +       { \"qcom-camss\", {} },\n> +       { \"sun6i-csi\", {} },\n>  };\n>\n>  } /* namespace */\n> @@ -145,7 +148,7 @@ class SimpleCameraData : public CameraData\n>  {\n>  public:\n>         SimpleCameraData(SimplePipelineHandler *pipe,\n> -                        const SimplePipelineInfo *info,\n> +                        unsigned int numStreams,\n>                          MediaEntity *sensor);\n>\n>         bool isValid() const { return sensor_ != nullptr; }\n> @@ -266,9 +269,9 @@ private:\n>   */\n>\n>  SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n> -                                  const SimplePipelineInfo *info,\n> +                                  unsigned int numStreams,\n>                                    MediaEntity *sensor)\n> -       : CameraData(pipe), streams_(info->numStreams)\n> +       : CameraData(pipe), streams_(numStreams)\n>  {\n>         int ret;\n>\n> @@ -934,6 +937,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator\n> *enumerator)\n>  {\n>         const SimplePipelineInfo *info = nullptr;\n>         MediaDevice *converter = nullptr;\n> +       unsigned int numStreams = 1;\n>\n>         for (const SimplePipelineInfo &inf : supportedDevices) {\n>                 DeviceMatch dm(inf.driver);\n> @@ -947,9 +951,13 @@ bool SimplePipelineHandler::match(DeviceEnumerator\n> *enumerator)\n>         if (!media_)\n>                 return false;\n>\n> -       if (info->converter) {\n> -               DeviceMatch converterMatch(info->converter);\n> +       for (const auto &[name, streams] : info->converters) {\n> +               DeviceMatch converterMatch(name);\n>                 converter = acquireMediaDevice(enumerator, converterMatch);\n> +               if (converter) {\n> +                       numStreams = streams;\n> +                       break;\n> +               }\n>         }\n>\n>         /* Locate the sensors. */\n> @@ -983,7 +991,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator\n> *enumerator)\n>\n>         for (MediaEntity *sensor : sensors) {\n>                 std::unique_ptr<SimpleCameraData> data =\n> -                       std::make_unique<SimpleCameraData>(this, info,\n> sensor);\n> +                       std::make_unique<SimpleCameraData>(this,\n> numStreams, sensor);\n>                 if (!data->isValid()) {\n>                         LOG(SimplePipeline, Error)\n>                                 << \"No valid pipeline for sensor '\"\n> --\n> 2.25.1\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 7ACD1C31FB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 May 2021 07:32:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E53866891E;\n\tMon, 17 May 2021 09:32:58 +0200 (CEST)","from mail-il1-x130.google.com (mail-il1-x130.google.com\n\t[IPv6:2607:f8b0:4864:20::130])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC538602B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 May 2021 09:32:55 +0200 (CEST)","by mail-il1-x130.google.com with SMTP id o10so4248238ilm.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 May 2021 00:32:55 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=baylibre-com.20150623.gappssmtp.com\n\theader.i=@baylibre-com.20150623.gappssmtp.com\n\theader.b=\"u/ry8P4V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20150623.gappssmtp.com; s=20150623;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=tDTfM0KPHFvCJ+SpHCPbs47hsY6A4bmjuALwohMP/Ok=;\n\tb=u/ry8P4Vcuqo2BftaLdZ+/c/tMop0MrozMa2BYkDkcG6CHCQ9dvY7O8N1kzJclIGgs\n\tq0OVChPquWqRmbimxOioSusdrpIR/nDiX39NvOnxaV9scnR7Ful7XrW5sFVAzvt4Pda8\n\tvwS0eKlK0Wo346inuaaoD0Gm9XzK9Z7AbbBuicY/bdZyTWFB/suA5Pk9bRxjj3Ztf/RJ\n\ts87le3V9wSShPhaZ6tI4a+m0eSuMUaBm5n8GblO5NOinqQWLiEBOso4f1siz7CmI5f62\n\t/jLxXhZi7NW3/sYNPw3SxKXPtB5+2Huh8qcm+3A4cUHZ458reHMX2PQqqr16fEVVeqK7\n\tam1w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=tDTfM0KPHFvCJ+SpHCPbs47hsY6A4bmjuALwohMP/Ok=;\n\tb=sF506kUiDkZWXgk4vZYdaR6EzECOOzHl5sw9EOpdx6L/cpLUXq3evBW4WIaBR8SGBv\n\tTdbFfINgS93bp2UGjEHB9DVbjM3qgNEaQ6sxz5+dj5J2KZKkuJss3O4xHc+Fbz2+cQwj\n\ttfttTv5WP+3f2zjNYMTVrTxe2Q/t3HzBXKfIJxSm+z9rbQtGnOR6POXYpdKL9RJE5pYN\n\tPI26eGL0kxhWZv+vBOlohpdGspTzIlIbI7LUTcqw2EfLvDM9LqIIyBMXyRzqgGMOPi8Y\n\tx7yKb9lBOPSPUZgO58LVc1zrWn4Qkg/UBBeTAoU5x80Vge4dyzS9X72BGG1Kev2ku7u9\n\trLfQ==","X-Gm-Message-State":"AOAM532Ts8wKEn1zFg44WWvLFGP9+UxLC76Sv93iZinAgDZodCJEz56z\n\tROphyG/MmdrajMYC514u4OQQ0zLTOF87RdD9K0jqgn7p79o=","X-Google-Smtp-Source":"ABdhPJzk5kU/yxeuLBgEW4CYQUuWlzEph3efT5A7NLzwuJP0u8L9LojMYxDJz2XbF7Bu5fUqjt1/TjJiFFEdB5puYgQ=","X-Received":"by 2002:a05:6e02:1d18:: with SMTP id\n\ti24mr31240934ila.157.1621236774719; \n\tMon, 17 May 2021 00:32:54 -0700 (PDT)","MIME-Version":"1.0","References":"<20210506180606.43447-1-pnguyen@baylibre.com>","In-Reply-To":"<20210506180606.43447-1-pnguyen@baylibre.com>","From":"Phi-bang Nguyen <pnguyen@baylibre.com>","Date":"Mon, 17 May 2021 09:32:44 +0200","Message-ID":"<CAO4hSrgNa+6oOXbK=LPsdGiXOD3WM_L4V3+VuvJfhFFaWS63Gw@mail.gmail.com>","To":"libcamera-devel@lists.libcamera.org","Content-Type":"multipart/alternative; boundary=\"0000000000000de9ed05c2819af2\"","Subject":"Re: [libcamera-devel] [PATCH v2] pipeline: simple: Rework the\n\tsupportedDevices list","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17222,"web_url":"https://patchwork.libcamera.org/comment/17222/","msgid":"<YKxgRuXiBZ6psLQ6@pendragon.ideasonboard.com>","date":"2021-05-25T02:26:14","subject":"Re: [libcamera-devel] [PATCH v2] pipeline: simple: Rework the\n\tsupportedDevices list","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Phi-Bang,\n\nThank you for the patch, and sorry for the delay.\n\nOn Thu, May 06, 2021 at 08:06:06PM +0200, Phi-Bang Nguyen wrote:\n> The supportedDevices may contain entries which have the same driver\n> but different converters. For example, if we add these two entries:\n> \n> { \"mtk-seninf\", \"mtk-mdp\", 3 },\n> { \"mtk-seninf\", \"mtk-mdp3\", 3 },\n> \n> the simple pipeline handler will always take the first one where it\n> can acquire the driver and skip the rest.\n> \n> So, make the changes to support this usecase.\n> \n> Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nand pushed.\n\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 30 +++++++++++++++---------\n>  1 file changed, 19 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index f6095d38..4c87ec4c 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -127,16 +127,19 @@ class SimplePipelineHandler;\n>  \n>  struct SimplePipelineInfo {\n>  \tconst char *driver;\n> -\tconst char *converter;\n> -\tunsigned int numStreams;\n> +\t/*\n> +\t * Each converter in the list contains the name\n> +\t * and the number of streams it supports.\n> +\t */\n> +\tstd::vector<std::pair<const char *, unsigned int>> converters;\n>  };\n>  \n>  namespace {\n>  \n>  static const SimplePipelineInfo supportedDevices[] = {\n> -\t{ \"imx7-csi\", \"pxp\", 1 },\n> -\t{ \"qcom-camss\", nullptr, 1 },\n> -\t{ \"sun6i-csi\", nullptr, 1 },\n> +\t{ \"imx7-csi\", { { \"pxp\", 1 } } },\n> +\t{ \"qcom-camss\", {} },\n> +\t{ \"sun6i-csi\", {} },\n>  };\n>  \n>  } /* namespace */\n> @@ -145,7 +148,7 @@ class SimpleCameraData : public CameraData\n>  {\n>  public:\n>  \tSimpleCameraData(SimplePipelineHandler *pipe,\n> -\t\t\t const SimplePipelineInfo *info,\n> +\t\t\t unsigned int numStreams,\n>  \t\t\t MediaEntity *sensor);\n>  \n>  \tbool isValid() const { return sensor_ != nullptr; }\n> @@ -266,9 +269,9 @@ private:\n>   */\n>  \n>  SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n> -\t\t\t\t   const SimplePipelineInfo *info,\n> +\t\t\t\t   unsigned int numStreams,\n>  \t\t\t\t   MediaEntity *sensor)\n> -\t: CameraData(pipe), streams_(info->numStreams)\n> +\t: CameraData(pipe), streams_(numStreams)\n>  {\n>  \tint ret;\n>  \n> @@ -934,6 +937,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n>  {\n>  \tconst SimplePipelineInfo *info = nullptr;\n>  \tMediaDevice *converter = nullptr;\n> +\tunsigned int numStreams = 1;\n>  \n>  \tfor (const SimplePipelineInfo &inf : supportedDevices) {\n>  \t\tDeviceMatch dm(inf.driver);\n> @@ -947,9 +951,13 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n>  \tif (!media_)\n>  \t\treturn false;\n>  \n> -\tif (info->converter) {\n> -\t\tDeviceMatch converterMatch(info->converter);\n> +\tfor (const auto &[name, streams] : info->converters) {\n> +\t\tDeviceMatch converterMatch(name);\n>  \t\tconverter = acquireMediaDevice(enumerator, converterMatch);\n> +\t\tif (converter) {\n> +\t\t\tnumStreams = streams;\n> +\t\t\tbreak;\n> +\t\t}\n>  \t}\n>  \n>  \t/* Locate the sensors. */\n> @@ -983,7 +991,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n>  \n>  \tfor (MediaEntity *sensor : sensors) {\n>  \t\tstd::unique_ptr<SimpleCameraData> data =\n> -\t\t\tstd::make_unique<SimpleCameraData>(this, info, sensor);\n> +\t\t\tstd::make_unique<SimpleCameraData>(this, numStreams, sensor);\n>  \t\tif (!data->isValid()) {\n>  \t\t\tLOG(SimplePipeline, Error)\n>  \t\t\t\t<< \"No valid pipeline for sensor '\"","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 0B022C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 May 2021 02:26:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19EC168919;\n\tTue, 25 May 2021 04:26:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1EC5E601A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 May 2021 04:26:20 +0200 (CEST)","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 84BDE344;\n\tTue, 25 May 2021 04:26:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EsT7T3FD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1621909579;\n\tbh=XZVKZNE69wFMy8myHu3RESZyHmE31+QRUeXqGu2NoqI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=EsT7T3FDtwdj145LBf1hBGq+uxMFw0KoJPrhwFo3LDJcqk/HV0/4B4AmFHAEzLzzj\n\tNdDmkhe68fBS0mLULLH8XyUQ5xKL2CdiCYY1GUmCjqQO2cBODaNKJJoFjyZ9QNtvs9\n\tgeMfMQTqe551p3YNhHKT+gpLSyi5fVUXHtbZCMd8=","Date":"Tue, 25 May 2021 05:26:14 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Phi-Bang Nguyen <pnguyen@baylibre.com>","Message-ID":"<YKxgRuXiBZ6psLQ6@pendragon.ideasonboard.com>","References":"<20210506180606.43447-1-pnguyen@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210506180606.43447-1-pnguyen@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v2] pipeline: simple: Rework the\n\tsupportedDevices list","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>"}}]