Show a patch.

GET /api/1.1/patches/1306/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1306,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1306/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1306/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190527001543.13593-14-niklas.soderlund@ragnatech.se>",
    "date": "2019-05-27T00:15:39",
    "name": "[libcamera-devel,13/17] test: stream: Add test for StreamFormat",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "034259b1aeeabafb55ff45be60b2f25d8adbff59",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1306/mbox/",
    "series": [
        {
            "id": 328,
            "url": "https://patchwork.libcamera.org/api/1.1/series/328/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=328",
            "date": "2019-05-27T00:15:28",
            "name": "libcamera: Add support for format information and validation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/328/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1306/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1306/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A707E618FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 May 2019 02:16:12 +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 a02b7618-8014-11e9-8ab4-005056917a89;\n\tMon, 27 May 2019 02:16:08 +0200 (CEST)"
        ],
        "X-Halon-ID": "a02b7618-8014-11e9-8ab4-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": "Mon, 27 May 2019 02:15:39 +0200",
        "Message-Id": "<20190527001543.13593-14-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190527001543.13593-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190527001543.13593-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 13/17] test: stream: Add test for\n\tStreamFormat",
        "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": "Mon, 27 May 2019 00:16:14 -0000"
    },
    "content": "Test that both discrete and range based stream format descriptions\nresult in good discrete frame sizes. The range based stream formats\nneeds to be fitted with a table of resolutions inside libcamera so if\nthat table is update this test might need to be updated.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n test/meson.build               |   1 +\n test/stream/meson.build        |  11 ++++\n test/stream/stream_formats.cpp | 102 +++++++++++++++++++++++++++++++++\n 3 files changed, 114 insertions(+)\n create mode 100644 test/stream/meson.build\n create mode 100644 test/stream/stream_formats.cpp",
    "diff": "diff --git a/test/meson.build b/test/meson.build\nindex 609aeab80e7d0f4f..5370f3028a4fe39d 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -4,6 +4,7 @@ subdir('camera')\n subdir('ipa')\n subdir('media_device')\n subdir('pipeline')\n+subdir('stream')\n subdir('v4l2_device')\n subdir('v4l2_subdevice')\n \ndiff --git a/test/stream/meson.build b/test/stream/meson.build\nnew file mode 100644\nindex 0000000000000000..5b42fe32b341970f\n--- /dev/null\n+++ b/test/stream/meson.build\n@@ -0,0 +1,11 @@\n+stream_tests = [\n+  [ 'stream_formats', 'stream_formats.cpp' ],\n+]\n+\n+foreach t : stream_tests\n+  exe = executable(t[0], t[1],\n+                   dependencies : libcamera_dep,\n+                   link_with : test_libraries,\n+                   include_directories : test_includes_internal)\n+  test(t[0], exe, suite: 'stream', is_parallel: false)\n+endforeach\ndiff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\nnew file mode 100644\nindex 0000000000000000..42a596cc69893b20\n--- /dev/null\n+++ b/test/stream/stream_formats.cpp\n@@ -0,0 +1,102 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * stream_formats.cpp - StreamFormats test\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/stream.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class StreamFormatsTest : public Test\n+{\n+protected:\n+\tint testSizes(std::string name, std::vector<Size> test, std::vector<Size> valid)\n+\t{\n+\t\tbool pass = false;\n+\n+\t\tfor (Size &size : test) {\n+\t\t\tpass = false;\n+\n+\t\t\tfor (Size &validSize : valid) {\n+\t\t\t\tif (size == validSize) {\n+\t\t\t\t\tpass = true;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif (!pass)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (!pass) {\n+\t\t\tcout << \"Failed \" << name << endl;\n+\t\t\tcout << \"Sizes to test:\" << endl;\n+\t\t\tfor (Size &size : test)\n+\t\t\t\tcout << size.toString() << endl;\n+\t\t\tcout << \"Valid sizes:\" << endl;\n+\t\t\tfor (Size &size : valid)\n+\t\t\t\tcout << size.toString() << endl;\n+\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\t/* Test discrete sizes */\n+\t\tStreamFormats discrete({\n+\t\t\t{ 1, { SizeRange(100, 100), SizeRange(200, 200) } },\n+\t\t\t{ 2, { SizeRange(300, 300), SizeRange(400, 400) } },\n+\t\t});\n+\n+\t\tif (testSizes(\"discrete 1\", discrete.sizes(1),\n+\t\t\t      { Size(100, 100), Size(200, 200) }))\n+\t\t\treturn TestFail;\n+\t\tif (testSizes(\"discrete 2\", discrete.sizes(2),\n+\t\t\t      { Size(300, 300), Size(400, 400) }))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Test range sizes */\n+\t\tStreamFormats range({\n+\t\t\t{ 1, { SizeRange(640, 480, 640, 480) } },\n+\t\t\t{ 2, { SizeRange(640, 480, 800, 600, 8, 8) } },\n+\t\t\t{ 3, { SizeRange(640, 480, 800, 600, 16, 16) } },\n+\t\t\t{ 4, { SizeRange(128, 128, 4096, 4096, 128, 128) } },\n+\t\t});\n+\n+\t\tif (testSizes(\"range 1\", range.sizes(1), { Size(640, 480) }))\n+\t\t\treturn TestFail;\n+\n+\t\tif (testSizes(\"range 2\", range.sizes(2), {\n+\t\t\t      Size(640, 480), Size(720, 480),\n+\t\t\t      Size(720, 576), Size(768, 480),\n+\t\t\t      Size(800, 600) }))\n+\t\t\treturn TestFail;\n+\n+\n+\t\tif (testSizes(\"range 3\", range.sizes(3), {\n+\t\t\t      Size(640, 480), Size(720, 480),\n+\t\t\t      Size(720, 576), Size(768, 480) }))\n+\t\t\treturn TestFail;\n+\n+\t\tif (testSizes(\"range 4\", range.sizes(4), {\n+\t\t\t      Size(1024, 768), Size(1280, 1024),\n+\t\t\t      Size(2048, 1152), Size(2048, 1536),\n+\t\t\t      Size(2560, 2048), Size(3200, 2048), }))\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(StreamFormatsTest)\n",
    "prefixes": [
        "libcamera-devel",
        "13/17"
    ]
}