Patch Detail
Show a patch.
GET /api/patches/832/?format=api
{ "id": 832, "url": "https://patchwork.libcamera.org/api/patches/832/?format=api", "web_url": "https://patchwork.libcamera.org/patch/832/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190402005332.25018-3-niklas.soderlund@ragnatech.se>", "date": "2019-04-02T00:53:29", "name": "[libcamera-devel,RFC,2/5] test: camera: Remove streams argument from configurationValid()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "aef6fbfb547316590c8388e891190b9a3cae4f69", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/832/mbox/", "series": [ { "id": 227, "url": "https://patchwork.libcamera.org/api/series/227/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=227", "date": "2019-04-02T00:53:27", "name": "libcamera: camera: Add support for stream usage hint", "version": 1, "mbox": "https://patchwork.libcamera.org/series/227/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/832/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/832/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E4AD9610C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 2 Apr 2019 02:54:00 +0200 (CEST)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid cd4cfd77-54e1-11e9-846a-005056917a89;\n\tTue, 02 Apr 2019 02:54:00 +0200 (CEST)" ], "X-Halon-ID": "cd4cfd77-54e1-11e9-846a-005056917a89", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 2 Apr 2019 02:53:29 +0200", "Message-Id": "<20190402005332.25018-3-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190402005332.25018-1-niklas.soderlund@ragnatech.se>", "References": "<20190402005332.25018-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC 2/5] test: camera: Remove streams argument\n\tfrom configurationValid()", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Tue, 02 Apr 2019 00:54:01 -0000" }, "content": "In preparation of reworking how a default configuration is retrieved\nfrom a camera remove the streams and validation using the stream when\njudging if a camera configuration is valid. This is needed as once\nstream usage hints are added applications will no longer fetch default\nconfiguration based on Stream IDs so using them to verify the returned\nformat is not useful.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n test/camera/camera_test.cpp | 26 ++++++++------------------\n test/camera/camera_test.h | 3 +--\n test/camera/capture.cpp | 2 +-\n test/camera/configuration_default.cpp | 2 +-\n test/camera/configuration_set.cpp | 2 +-\n 5 files changed, 12 insertions(+), 23 deletions(-)", "diff": "diff --git a/test/camera/camera_test.cpp b/test/camera/camera_test.cpp\nindex a92f2165bf3a53c1..5985b85c44816e30 100644\n--- a/test/camera/camera_test.cpp\n+++ b/test/camera/camera_test.cpp\n@@ -46,27 +46,17 @@ void CameraTest::cleanup()\n \tcm_->stop();\n };\n \n-bool CameraTest::configurationValid(const std::set<Stream *> &streams,\n-\t\t\t\t const std::map<Stream *, StreamConfiguration> &conf) const\n+bool CameraTest::configurationValid(const std::map<Stream *, StreamConfiguration> &config) const\n {\n-\t/* Test that the numbers of streams matches that of configuration. */\n-\tif (streams.size() != conf.size())\n+\t/* Test that the configuration is not empty. */\n+\tif (config.empty())\n \t\treturn false;\n \n-\t/*\n-\t * Test that stream can be found in configuration and that the\n-\t * configuration is valid.\n-\t */\n-\tfor (Stream *stream : streams) {\n-\t\tstd::map<Stream *, StreamConfiguration>::const_iterator it =\n-\t\t\tconf.find(stream);\n-\n-\t\tif (it == conf.end())\n-\t\t\treturn false;\n-\n-\t\tconst StreamConfiguration *sconf = &it->second;\n-\t\tif (sconf->width == 0 || sconf->height == 0 ||\n-\t\t sconf->pixelFormat == 0 || sconf->bufferCount == 0)\n+\t/* Test that configuration is valid. */\n+\tfor (auto const &it : config) {\n+\t\tconst StreamConfiguration &conf = it.second;\n+\t\tif (conf.width == 0 || conf.height == 0 ||\n+\t\t conf.pixelFormat == 0 || conf.bufferCount == 0)\n \t\t\treturn false;\n \t}\n \ndiff --git a/test/camera/camera_test.h b/test/camera/camera_test.h\nindex 48fb47a23fe8f49c..5801fad3281e1653 100644\n--- a/test/camera/camera_test.h\n+++ b/test/camera/camera_test.h\n@@ -23,8 +23,7 @@ protected:\n \tint init();\n \tvoid cleanup();\n \n-\tbool configurationValid(const std::set<Stream *> &streams,\n-\t\t\t\tconst std::map<Stream *, StreamConfiguration> &conf) const;\n+\tbool configurationValid(const std::map<Stream *, StreamConfiguration> &config) const;\n \n \tstd::shared_ptr<Camera> camera_;\n \ndiff --git a/test/camera/capture.cpp b/test/camera/capture.cpp\nindex 28eb61405d90a4c7..f6932b7505571712 100644\n--- a/test/camera/capture.cpp\n+++ b/test/camera/capture.cpp\n@@ -48,7 +48,7 @@ protected:\n \t\t\tcamera_->streamConfiguration(streams);\n \t\tStreamConfiguration *sconf = &conf.begin()->second;\n \n-\t\tif (!configurationValid(streams, conf)) {\n+\t\tif (!configurationValid(conf)) {\n \t\t\tcout << \"Failed to read default configuration\" << endl;\n \t\t\treturn TestFail;\n \t\t}\ndiff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp\nindex 71e79844667591b2..53ee021d33ca39b1 100644\n--- a/test/camera/configuration_default.cpp\n+++ b/test/camera/configuration_default.cpp\n@@ -32,7 +32,7 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tif (!configurationValid(streams, conf)) {\n+\t\tif (!configurationValid(conf)) {\n \t\t\tcout << \"Default configuration invalid\" << endl;\n \t\t\treturn TestFail;\n \t\t}\ndiff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp\nindex dedb85009335aa46..cac1da959f241bc5 100644\n--- a/test/camera/configuration_set.cpp\n+++ b/test/camera/configuration_set.cpp\n@@ -23,7 +23,7 @@ protected:\n \t\t\tcamera_->streamConfiguration(streams);\n \t\tStreamConfiguration *sconf = &conf.begin()->second;\n \n-\t\tif (!configurationValid(streams, conf)) {\n+\t\tif (!configurationValid(conf)) {\n \t\t\tcout << \"Failed to read default configuration\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n", "prefixes": [ "libcamera-devel", "RFC", "2/5" ] }