{"id":12216,"url":"https://patchwork.libcamera.org/api/1.1/patches/12216/?format=json","web_url":"https://patchwork.libcamera.org/patch/12216/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210506180606.43447-1-pnguyen@baylibre.com>","date":"2021-05-06T18:06:06","name":"[libcamera-devel,v2] pipeline: simple: Rework the supportedDevices list","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f964995be7981ecabe5f0fe81b2194e6aaebdb4f","submitter":{"id":79,"url":"https://patchwork.libcamera.org/api/1.1/people/79/?format=json","name":"Phi-bang Nguyen","email":"pnguyen@baylibre.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12216/mbox/","series":[{"id":2006,"url":"https://patchwork.libcamera.org/api/1.1/series/2006/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2006","date":"2021-05-06T18:06:06","name":"[libcamera-devel,v2] pipeline: simple: Rework the supportedDevices list","version":2,"mbox":"https://patchwork.libcamera.org/series/2006/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12216/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12216/checks/","tags":{},"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 560E6BDE7F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 May 2021 18:06:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CFEF668918;\n\tThu,  6 May 2021 20:06:24 +0200 (CEST)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8228B68901\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 May 2021 20:06:23 +0200 (CEST)","by mail-wr1-x433.google.com with SMTP id t18so6575746wry.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 May 2021 11:06:23 -0700 (PDT)","from localhost.localdomain (206.159.69.91.rev.sfr.net.\n\t[91.69.159.206]) by smtp.googlemail.com with ESMTPSA id\n\tv15sm10714297wmj.39.2021.05.06.11.06.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 May 2021 11:06:21 -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=\"EU/4m4x4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=GsDPhECXsTuFqXG5XhYx3x5CJyiD480eYXrWI7N1qF4=;\n\tb=EU/4m4x48YdstLfAOn74FTxxdz3hu9qaolVimpL4tzR0zKJNxC/C20H1gVoj90dDJt\n\tgr+Za6Qfvq2O5EyCAZ+Xj+S5myXpzfsbmnjZhH349Wdb2aKofMSsfiqAnsIchDl5Pgkq\n\tmVZ7c+hRY1KixhRXtEgAcFIxEfB4fUpHAcZE0nU7xW1tPwrZGNIeIRqEaIYspBdEU225\n\tlKF+hg/5CgdCSlmJj43XDTzeDh8IvVhQRwMgzBMpZ/P10ym3yS0FZHM+wUwlhbHMfBol\n\tSsTNIeJPEp0BT8iOcEzAqgxY5q9Iy45hYH0tOb9h/ivMQtA1N6FYCGSNOcN+2G8etZp0\n\tat+Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=GsDPhECXsTuFqXG5XhYx3x5CJyiD480eYXrWI7N1qF4=;\n\tb=lSeMNMW1Tsr/qc3v204OhFs7YgOUBM/FvV0QEbTXnUqXaqX8fOdzi/4CPkUOGfHJsY\n\tDpwkUVx1TdMneovh/c+Uv9Wx5zZxIf6zoaOIlTinzRAkz3OI6CYa3aE2MV6zl/QuolpR\n\t+KS62939cpvWqPkwerAjXAux4/hehjPp0JHsJ0GGfLfDr1f1AK2YInbALvyjbk7eO/y0\n\thuOITMZTO3H4+1E/pqUDhtCpTGtPy/Ldhg/3RaxNWKQo0YCAc8UQKzQFNpTGGmFNwQ7m\n\tOTCMKFjaIju1cLpkTo9spQKcsErbLjrdkg4JZRCeqddfOnC/ckm/BdTwc8DSp6Dz8RSw\n\tttAA==","X-Gm-Message-State":"AOAM530IKwBAC+yZYr6lXRwzPobNRHzK4URU9FbcfnR+HBurpSWcr2yB\n\toRRwtYbWWt0g00udc0lhmCNOx4OhJLq5LA==","X-Google-Smtp-Source":"ABdhPJwsH0ppTGqI2TkLSvol9BVdwZNGZNPKWihBDOagj+A6SIVt5zptXwqzxs2Qum6BSG7eIN2ypg==","X-Received":"by 2002:a5d:6e11:: with SMTP id\n\th17mr6803284wrz.331.1620324382888; \n\tThu, 06 May 2021 11:06:22 -0700 (PDT)","From":"Phi-Bang Nguyen <pnguyen@baylibre.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 May 2021 20:06:06 +0200","Message-Id":"<20210506180606.43447-1-pnguyen@baylibre.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Subject":"[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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The supportedDevices may contain entries which have the same driver\nbut different converters. For example, if we add these two entries:\n\n{ \"mtk-seninf\", \"mtk-mdp\", 3 },\n{ \"mtk-seninf\", \"mtk-mdp3\", 3 },\n\nthe simple pipeline handler will always take the first one where it\ncan acquire the driver and skip the rest.\n\nSo, make the changes to support this usecase.\n\nSigned-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(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 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 '\"\n","prefixes":["libcamera-devel","v2"]}