{"id":11139,"url":"https://patchwork.libcamera.org/api/patches/11139/?format=json","web_url":"https://patchwork.libcamera.org/patch/11139/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210204100541.657503-2-hiroh@chromium.org>","date":"2021-02-04T10:05:36","name":"[libcamera-devel,RFC,1/6] libcamera: camera: Add tryValidate() to CameraConfiguration","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"318082671e8d01edf3d497ec0e49c6e5f4471630","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11139/mbox/","series":[{"id":1650,"url":"https://patchwork.libcamera.org/api/series/1650/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1650","date":"2021-02-04T10:05:35","name":"Support stream mapping in Android HAL adaptation layer","version":1,"mbox":"https://patchwork.libcamera.org/series/1650/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11139/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11139/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 45123BD162\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Feb 2021 10:05:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 13CCD6142A;\n\tThu,  4 Feb 2021 11:05:53 +0100 (CET)","from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com\n\t[IPv6:2607:f8b0:4864:20::1035])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 288B061402\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Feb 2021 11:05:51 +0100 (CET)","by mail-pj1-x1035.google.com with SMTP id s24so1410042pjp.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 04 Feb 2021 02:05:51 -0800 (PST)","from hiroh.c.googlers.com.com\n\t(128.141.236.35.bc.googleusercontent.com. [35.236.141.128])\n\tby smtp.gmail.com with ESMTPSA id\n\tj9sm5808418pgb.47.2021.02.04.02.05.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 04 Feb 2021 02:05:48 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Hj9vuvtL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=c3N37gVuGh2sjzISx2yb690NFKzleVus8ZFnC08+rkU=;\n\tb=Hj9vuvtLXgqP0Rv+Jd62DahTfGNdjUNdcsOVpIubyeD7JlwCe+xbO+DCmX8sq2Bejp\n\tahNShZqgkLIQuN/5zYmHzMdR3G43gkUHsdjJYbw5lAKXD9sSQypRjTAOqeF2R85gGUb2\n\t4MaG9PdifeB/2a2uZj4zU9xfn3HzmOkDRS9VU=","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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=c3N37gVuGh2sjzISx2yb690NFKzleVus8ZFnC08+rkU=;\n\tb=ehUr9Q2fvHzbI7UGj6WQqTq8Ij1g+DIwqmu8src8Zm8dBjPzvh3EvxIgDuEjOW5cHo\n\tkzU6vB69GRPPAxLnYGEKQz8EkStPk5Z5zvWf4VkSC/YD1Pt4BOsuTEpigpa19yVxr+fF\n\tQ+dKDtXnynBDiUmsbjgwTs6xuJkbw3SGOcsOKqQ1t6zu1wnQnRdShsmmoeTvRuEA/iYg\n\ty04cUXQ/RKXBdpO0fzUKqvXJW3NsetbZxmgwyE2RA8+JScZWWhtKey3EYJbbjmo4PRUc\n\t6NKEfHtODZWPw4xI90fnqeoXI+U04PHbjtDC6WSRDLi+2ZnAUTsJVKALLnCPC+0XPo7W\n\tYkxw==","X-Gm-Message-State":"AOAM533QE8c+aHvISHJxpsm841Rzpa24b4a+RP94CiOMKbELfPTn4TG/\n\t4Kf3NsH94Bk86Q3KlyIdcR/D0c0JIQwCzvEV","X-Google-Smtp-Source":"ABdhPJz5Er5I3t6Oscrq7DymUBU2iIb5R1wZH1F6ut4r+zzc0Oal5QcEtwMKJ2BY2Ij5GGaPcOVriw==","X-Received":"by 2002:a17:90a:2f83:: with SMTP id\n\tt3mr7809433pjd.128.1612433149634; \n\tThu, 04 Feb 2021 02:05:49 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  4 Feb 2021 10:05:36 +0000","Message-Id":"<20210204100541.657503-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.30.0.365.g02bc693789-goog","In-Reply-To":"<20210204100541.657503-1-hiroh@chromium.org>","References":"<20210204100541.657503-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [RFC PATCH 1/6] libcamera: camera: Add\n\ttryValidate() to CameraConfiguration","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":"hanlinchen@chromium.org","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":"This adds tryValidate() to CameraConfiguration. The function\ndoesn't change CameraConfiguration status. It dry-runs\nvalidate() with passed configurations, so that a caller can know\nacceptable configurations.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/camera.h |  1 +\n src/libcamera/camera.cpp   | 22 ++++++++++++++++++++++\n 2 files changed, 23 insertions(+)\n\n--\n2.30.0.365.g02bc693789-goog","diff":"diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex f94f8599..ac3c7f5a 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -43,6 +43,7 @@ public:\n\n \tvoid addConfiguration(const StreamConfiguration &cfg);\n \tvirtual Status validate() = 0;\n+\tvirtual bool tryValidate(std::vector<std::pair<StreamConfiguration, Status>> &config) const;\n\n \tStreamConfiguration &at(unsigned int index);\n \tconst StreamConfiguration &at(unsigned int index) const;\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex c9c79b91..6c4ae727 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -171,6 +171,28 @@ void CameraConfiguration::addConfiguration(const StreamConfiguration &cfg)\n \tconfig_.push_back(cfg);\n }\n\n+/**\n+ * \\fn CameraConfiguration::tryValidate()\n+ * \\brief construct configurations from config, which can be produced\n+ * simultaneously w/o adjust.\n+ *\n+ * This method modifies config to satisfy\n+ * 1.) config[i].second is Invalid or\n+ * 2.) config[i].second is either Valid or Adjust and the config[i].first can be\n+ *     accepted by a native camera. validate() returns Valid or Adjust with the\n+ *     configurations.\n+ *\n+ * \\todo: Remove this tryValidate() in this base class.\n+ */\n+bool CameraConfiguration::tryValidate(\n+\tstd::vector<std::pair<StreamConfiguration, Status>> &config) const\n+{\n+\tfor (auto &c : config) {\n+\t\tc.second = Invalid;\n+\t}\n+\treturn false;\n+}\n+\n /**\n  * \\fn CameraConfiguration::validate()\n  * \\brief Validate and possibly adjust the camera configuration\n","prefixes":["libcamera-devel","RFC","1/6"]}