Patch Detail
Show a patch.
GET /api/1.1/patches/17536/?format=api
{ "id": 17536, "url": "https://patchwork.libcamera.org/api/1.1/patches/17536/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17536/", "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": "<20221006120105.3861831-4-paul.elder@ideasonboard.com>", "date": "2022-10-06T12:01:01", "name": "[libcamera-devel,3/7] utils: libtuning: parsers: Add raspberrypi parser", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0808c03e86097ae16d6ee991a3d65c7d6231c3fa", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17536/mbox/", "series": [ { "id": 3536, "url": "https://patchwork.libcamera.org/api/1.1/series/3536/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3536", "date": "2022-10-06T12:00:58", "name": "utils: tuning: Add a new tuning infrastructure", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3536/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17536/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17536/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 5B5FEC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 6 Oct 2022 12:01:26 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2153562CFD;\n\tThu, 6 Oct 2022 14:01:26 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 30CBC62CF7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 6 Oct 2022 14:01:24 +0200 (CEST)", "from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BB24FA1C;\n\tThu, 6 Oct 2022 14:01:22 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665057686;\n\tbh=SSXu8Blp2anhjs1wkvhoOZvB0DTiqluNwgnzmvqUjQ0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=tRUZ8tdHodCNqiHAKnGVxdJ8TAvZnOv70Duy9/A7kCTBgaqqzNZrG/tn5BvZdK4eO\n\te4AK6sOj/5x2q5tXQmq/jnGV5/uoDAXGHt2aI6Xdiqn2z/nvE0vuobDNKzLaTEdSDf\n\tdvuEZxpkQ+7aymJRXXltpRDjHH0Hqx5J5Dm/n4dnZAqPOeJ4HZ2Y/cbEs0y6B1HKEx\n\tAelOIyvRbVrX4AP65x3BRQSzjLAglnfS9QwAp61nuDqdE9KuJ+F/O+yq50cMUM1DEb\n\t9xiB1pnPqCi5pqof/8hhNNCjljWp3teLZJ0Kg9SO9oqHycBp+rfpYByOj4IuUHb2QY\n\tcFcFmFR6Cr9cQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1665057683;\n\tbh=SSXu8Blp2anhjs1wkvhoOZvB0DTiqluNwgnzmvqUjQ0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=m148hrkFK6AKYM89dPpx9rJKlknMSXjXJaKt5mN4f7cNx6HjJmC0VAJSizmrDEGLm\n\th64m72n0ndf5WxjgmylKE2JAfXdaup6fm/vn473IbkFghGB98kcSf/JVqvwd4VAhwB\n\tQlbd5Wh3nGscIOEr27q4N12cMvMqHfTD2vqeq3IQ=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"m148hrkF\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 6 Oct 2022 21:01:01 +0900", "Message-Id": "<20221006120105.3861831-4-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20221006120105.3861831-1-paul.elder@ideasonboard.com>", "References": "<20221006120105.3861831-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/7] utils: libtuning: parsers: Add\n\traspberrypi parser", "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>", "From": "Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Paul Elder <paul.elder@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a parser to libtuning for parsing configuration files that are the\nsame format as raspberrypi's ctt's configuration files.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n utils/tuning/libtuning/parsers/__init__.py | 1 +\n .../libtuning/parsers/raspberrypi_parser.py | 82 +++++++++++++++++++\n 2 files changed, 83 insertions(+)\n create mode 100644 utils/tuning/libtuning/parsers/raspberrypi_parser.py", "diff": "diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py\nindex e69de29b..ba829161 100644\n--- a/utils/tuning/libtuning/parsers/__init__.py\n+++ b/utils/tuning/libtuning/parsers/__init__.py\n@@ -0,0 +1 @@\n+from libtuning.parsers.raspberrypi_parser import RaspberryPiParser\ndiff --git a/utils/tuning/libtuning/parsers/raspberrypi_parser.py b/utils/tuning/libtuning/parsers/raspberrypi_parser.py\nnew file mode 100644\nindex 00000000..1a7d4c0a\n--- /dev/null\n+++ b/utils/tuning/libtuning/parsers/raspberrypi_parser.py\n@@ -0,0 +1,82 @@\n+from .parser import Parser\n+\n+import json\n+import numbers\n+\n+import libtuning.utils as utils\n+\n+\n+class RaspberryPiParser(Parser):\n+ def __init__(self):\n+ super().__init__()\n+\n+ # The string in the 'disable' and 'plot' lists are formatted as\n+ # 'rpi.{module_name}'.\n+ # @brief Enumerate, as a module, @a listt if its value exists in @a dictt\n+ # and it is the name of a valid module in @a modules\n+ def enumerate_rpi_modules(listt, dictt, modules):\n+ for x in listt:\n+ name = x.replace('rpi.', '')\n+ if name not in dictt:\n+ continue\n+ module = utils.getModuleByName(modules, name)\n+ if module is not None:\n+ yield module\n+\n+ def _validMacbethOption(value):\n+ if not isinstance(value, dict):\n+ return False\n+\n+ if list(value.keys()) != ['small', 'show']:\n+ return False\n+\n+ for val in value.values():\n+ if not isinstance(val, numbers.Number):\n+ return False\n+\n+ return True\n+\n+ def __parse__(self, config_file, modules):\n+ with open(config_file, 'r') as config_json:\n+ config = json.load(config_json)\n+\n+ disable = []\n+ for module in enumerate_rpi_modules(config['disable'], config, modules):\n+ disable.append(module)\n+ # Remove the disabled module's config too\n+ config.pop(module.name)\n+ config.pop('disable')\n+\n+ # The raspberrypi config format has 'plot' map to a list of module\n+ # names which should be plotted. libtuning has each module contain the\n+ # plot information in itself so do this conversion.\n+\n+ for module in enumerate_rpi_modules(config['plot'], config, modules):\n+ # It's fine to set the value of a potentially disabled module, as\n+ # the object still exists at this point\n+ module.appendValue('debug', 'plot')\n+ config.pop('plot')\n+\n+ # Convert the keys from module name to module instance\n+\n+ for module_name in config:\n+ module = utils.getModuleByName(modules, module_name)\n+ if module is not None and \\\n+ module.validateConfig(config[module_name]):\n+ new_config[module] = config.pop(module_name)\n+\n+ new_config['general'] = {}\n+\n+ if 'blacklevel' in config:\n+ if not isinstance(config['blacklevel'], numbers.Number):\n+ raise TypeError('Config \"blacklevel\" must be a number')\n+ new_config['general']['blacklevel'] = config['blacklevel']\n+\n+ if 'macbeth' in config:\n+ if not _validMacbethOption(config['macbeth']):\n+ raise TypeError('Config \"macbeth\" must be a dict: {\"small\": number, \"show\": number}')\n+ new_config['general']['macbeth'] = config['macbeth']\n+ else:\n+ new_config['general']['macbeth'] = {'small': 0, 'show': 0}\n+\n+ return new_config, disable\n", "prefixes": [ "libcamera-devel", "3/7" ] }