Patch Detail
Show a patch.
GET /api/patches/16689/?format=api
{ "id": 16689, "url": "https://patchwork.libcamera.org/api/patches/16689/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16689/", "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": "<20220719121003.1829916-3-paul.elder@ideasonboard.com>", "date": "2022-07-19T12:10:03", "name": "[libcamera-devel,RFC,2/2] pipeline: rkisp1: Query the driver for formats", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0e18d7d7aa4f80f797677698e8872262045830dc", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16689/mbox/", "series": [ { "id": 3300, "url": "https://patchwork.libcamera.org/api/series/3300/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3300", "date": "2022-07-19T12:10:01", "name": "rkisp1: Get supported formats from driver", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3300/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16689/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16689/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 49DE3BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 12:10:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 067C46048A;\n\tTue, 19 Jul 2022 14:10:22 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C85EB63318\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jul 2022 14:10:19 +0200 (CEST)", "from pyrite.rasen.tech (softbank036240121080.bbtec.net\n\t[36.240.121.80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E0A46EE;\n\tTue, 19 Jul 2022 14:10:18 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658232622;\n\tbh=V0GxVPxAtHGHz7vI/8zM3dm/leDGNJAihXMNVAMZTL4=;\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=LqzXK7VO975JZXRrjmSlhy4uamU/6nDV/KeDLHzWgTEr/MKGtrUniAjQLEjKbfqqn\n\tnXcHcK0FZ9KLTAFlfz6UqrBA79foFIehNqppXGvI3fCK2M8+pD44sM9mqURtNfcJcT\n\tYD3WcpWTgJCFxvWuBq5Q8fyYA5yp08XvpN/JJnmcXrMXjtUIahWNBCdDUB6HtslwIP\n\tvPJeMNyRWiDdoEQtLqXWa0W6DHCGeFQ9UHXrIEvimIwDwb/1ppzIueKk3//8W3tB7G\n\tzkVPcvJzQXfxNspPu32TQ9VLtHr+fgE4URqD19+TYsREqyCXJj1KMJ4XKbc0TDdDQN\n\t76+W5qb/C7GGQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658232619;\n\tbh=V0GxVPxAtHGHz7vI/8zM3dm/leDGNJAihXMNVAMZTL4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=f/nihdteKACtHyIGDNt4inmqoZGD7AFoDAkUWkJEwY0ww9cBuAmRpXZpXzGMr4HMb\n\tirLNJjIwhCEmUWnb50/I8ux0L/FeaJ68zLOLfZkL3be4c/VeC8QYEWaLvpX4lIb0jR\n\trszqqvf1zKc6bCATDdQlKhSHSAq7d/M2usfjJwXM=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"f/nihdte\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 19 Jul 2022 21:10:03 +0900", "Message-Id": "<20220719121003.1829916-3-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20220719121003.1829916-1-paul.elder@ideasonboard.com>", "References": "<20220719121003.1829916-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH 2/2] pipeline: rkisp1: Query the\n\tdriver for formats", "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": "Query the driver for the output formats that it supports, instead of\nhardcoding it.\n\nThis allows future-proofing for formats that are supported by some but\nnot all versions of the driver.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nOne problem with this patch is that it causes YVU422 to be reported as\nsupported, but as discussed before, libcamera will try to configure a\nnon-existent pixelformat to the V4L2 device, as YVU422P does not exist\nas a V4L2 format, and there currently is no infrastructure in place to\nlet libcamera configure YVU422M instead (which would work).\n\nA patch [1] was submitted to fix this (tell libcamera to configure\nYVU422M instead of the non-existent YVU422P), but it has been canceled\nas a parallel effort is apparently in place [2].\n\n[1] https://patchwork.libcamera.org/patch/16573/\n[2] https://patchwork.libcamera.org/patch/16573/#23799\n\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 50 +++++++++----------\n src/libcamera/pipeline/rkisp1/rkisp1_path.h | 6 ++-\n 2 files changed, 29 insertions(+), 27 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 6f175758..00b5c3ed 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -20,9 +20,9 @@ namespace libcamera {\n \n LOG_DECLARE_CATEGORY(RkISP1)\n \n-RkISP1Path::RkISP1Path(const char *name, const Span<const PixelFormat> &formats,\n+RkISP1Path::RkISP1Path(const char *name,\n \t\t const Size &minResolution, const Size &maxResolution)\n-\t: name_(name), running_(false), formats_(formats),\n+\t: name_(name), running_(false),\n \t minResolution_(minResolution), maxResolution_(maxResolution),\n \t link_(nullptr)\n {\n@@ -41,6 +41,8 @@ bool RkISP1Path::init(MediaDevice *media)\n \tif (video_->open() < 0)\n \t\treturn false;\n \n+\tformats_ = fetchFormats(video_);\n+\n \tlink_ = media->link(\"rkisp1_isp\", 2, resizer, 0);\n \tif (!link_)\n \t\treturn false;\n@@ -48,6 +50,24 @@ bool RkISP1Path::init(MediaDevice *media)\n \treturn true;\n }\n \n+std::vector<PixelFormat> RkISP1Path::fetchFormats(std::unique_ptr<V4L2VideoDevice> &video)\n+{\n+\tV4L2VideoDevice::Formats v4l2Formats = video->formats(0, true);\n+\tstd::vector<PixelFormat> formats;\n+\n+\tfor (auto pair : v4l2Formats) {\n+\t\tconst PixelFormat pixelFormat = pair.first.toPixelFormat();\n+\t\tconst PixelFormatInfo info = PixelFormatInfo::info(pixelFormat);\n+\n+\t\tif (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)\n+\t\t\tcontinue;\n+\n+\t\tformats.push_back(pixelFormat);\n+\t}\n+\n+\treturn formats;\n+}\n+\n StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution)\n {\n \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n@@ -72,6 +92,7 @@ CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg)\n \tconst StreamConfiguration reqCfg = *cfg;\n \tCameraConfiguration::Status status = CameraConfiguration::Valid;\n \n+\t/* NV12 is definitely supported, no need to check */\n \tif (std::find(formats_.begin(), formats_.end(), cfg->pixelFormat) ==\n \t formats_.end())\n \t\tcfg->pixelFormat = formats::NV12;\n@@ -207,39 +228,18 @@ void RkISP1Path::stop()\n namespace {\n constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 };\n constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 };\n-constexpr std::array<PixelFormat, 6> RKISP1_RSZ_MP_FORMATS{\n-\tformats::YUYV,\n-\tformats::NV16,\n-\tformats::NV61,\n-\tformats::NV21,\n-\tformats::NV12,\n-\tformats::R8,\n-\t/* \\todo Add support for RAW formats. */\n-};\n \n constexpr Size RKISP1_RSZ_SP_SRC_MIN{ 32, 16 };\n constexpr Size RKISP1_RSZ_SP_SRC_MAX{ 1920, 1920 };\n-constexpr std::array<PixelFormat, 8> RKISP1_RSZ_SP_FORMATS{\n-\tformats::YUYV,\n-\tformats::NV16,\n-\tformats::NV61,\n-\tformats::NV21,\n-\tformats::NV12,\n-\tformats::R8,\n-\tformats::RGB565,\n-\tformats::XRGB8888,\n-};\n } /* namespace */\n \n RkISP1MainPath::RkISP1MainPath()\n-\t: RkISP1Path(\"main\", RKISP1_RSZ_MP_FORMATS,\n-\t\t RKISP1_RSZ_MP_SRC_MIN, RKISP1_RSZ_MP_SRC_MAX)\n+\t: RkISP1Path(\"main\", RKISP1_RSZ_MP_SRC_MIN, RKISP1_RSZ_MP_SRC_MAX)\n {\n }\n \n RkISP1SelfPath::RkISP1SelfPath()\n-\t: RkISP1Path(\"self\", RKISP1_RSZ_SP_FORMATS,\n-\t\t RKISP1_RSZ_SP_SRC_MIN, RKISP1_RSZ_SP_SRC_MAX)\n+\t: RkISP1Path(\"self\", RKISP1_RSZ_SP_SRC_MIN, RKISP1_RSZ_SP_SRC_MAX)\n {\n }\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex f3f1ae39..77ea632b 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -30,7 +30,7 @@ struct V4L2SubdeviceFormat;\n class RkISP1Path\n {\n public:\n-\tRkISP1Path(const char *name, const Span<const PixelFormat> &formats,\n+\tRkISP1Path(const char *name,\n \t\t const Size &minResolution, const Size &maxResolution);\n \n \tbool init(MediaDevice *media);\n@@ -57,12 +57,14 @@ public:\n \tSignal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }\n \n private:\n+\tstd::vector<PixelFormat> fetchFormats(std::unique_ptr<V4L2VideoDevice> &video);\n+\n \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n \n \tconst char *name_;\n \tbool running_;\n \n-\tconst Span<const PixelFormat> formats_;\n+\tstd::vector<PixelFormat> formats_;\n \tconst Size minResolution_;\n \tconst Size maxResolution_;\n \n", "prefixes": [ "libcamera-devel", "RFC", "2/2" ] }