Patch Detail
Show a patch.
GET /api/1.1/patches/991/?format=api
{ "id": 991, "url": "https://patchwork.libcamera.org/api/1.1/patches/991/?format=api", "web_url": "https://patchwork.libcamera.org/patch/991/", "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": "<20190415165700.22970-11-laurent.pinchart@ideasonboard.com>", "date": "2019-04-15T16:56:59", "name": "[libcamera-devel,10/11] libcamera: pipeline: ipu3: Use the new CameraSensor class", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "12fa52fe4780f48c3b2589f64b77d9c713b106bf", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/991/mbox/", "series": [ { "id": 250, "url": "https://patchwork.libcamera.org/api/1.1/series/250/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=250", "date": "2019-04-15T16:56:49", "name": "Rockchip ISP pipeline handler", "version": 1, "mbox": "https://patchwork.libcamera.org/series/250/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/991/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/991/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A02060DCD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 18:57:18 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AAB39333\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 18:57:17 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555347437;\n\tbh=d5n1IDYL+g4wIEsKjbsQrvWlYR4aMV37xjBq86RQpQs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=UYVhJakjJdZRg7Q49xR+rZ5c+0Yy62EtsO/ouyrH2OE1yXO9HnAS37FRtLT/vMe+b\n\tnW6pAhNyEHq2uyJMfDXFhrDCSJmAaHHPN9gVU8H5CZN7jB7lJ5sI36o5MqJjUhMUwU\n\t6h49yKGycHJRzasr6lijWRHnG1z9mUjAFI9vIn+w=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 15 Apr 2019 19:56:59 +0300", "Message-Id": "<20190415165700.22970-11-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190415165700.22970-1-laurent.pinchart@ideasonboard.com>", "References": "<20190415165700.22970-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 10/11] libcamera: pipeline: ipu3: Use the\n\tnew CameraSensor class", "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, 15 Apr 2019 16:57:20 -0000" }, "content": "Replace the manual handling of sensor formats with usage of the new\nCameraSensor class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 78 +++++-----------------------\n 1 file changed, 14 insertions(+), 64 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex e3c79f93963e..1326a1be105f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -15,6 +15,7 @@\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n+#include \"camera_sensor.h\"\n #include \"device_enumerator.h\"\n #include \"log.h\"\n #include \"media_device.h\"\n@@ -124,11 +125,7 @@ public:\n \n \tV4L2Device *output_;\n \tV4L2Subdevice *csi2_;\n-\tV4L2Subdevice *sensor_;\n-\n-\t/* Maximum sizes and the mbus code used to produce them. */\n-\tunsigned int mbusCode_;\n-\tSize maxSize_;\n+\tCameraSensor *sensor_;\n \n \tBufferPool pool_;\n };\n@@ -255,8 +252,9 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \t\treturn -EINVAL;\n \t}\n \n-\tif (cfg.width > cio2->maxSize_.width ||\n-\t cfg.height > cio2->maxSize_.height) {\n+\tconst Size &resolution = cio2->sensor_->resolution();\n+\tif (cfg.width > resolution.width ||\n+\t cfg.height > resolution.height) {\n \t\tLOG(IPU3, Error)\n \t\t\t<< \"Invalid stream size: larger than sensor resolution\";\n \t\treturn -EINVAL;\n@@ -1036,31 +1034,11 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \t * \\todo Define when to open and close video device nodes, as they\n \t * might impact on power consumption.\n \t */\n-\tsensor_ = new V4L2Subdevice(sensorEntity);\n-\tret = sensor_->open();\n+\tsensor_ = new CameraSensor(sensorEntity);\n+\tret = sensor_->init();\n \tif (ret)\n \t\treturn ret;\n \n-\tfor (auto it : sensor_->formats(0)) {\n-\t\tint mbusCode = mediaBusToFormat(it.first);\n-\t\tif (mbusCode < 0)\n-\t\t\tcontinue;\n-\n-\t\tfor (const SizeRange &size : it.second) {\n-\t\t\tif (maxSize_.width < size.max.width &&\n-\t\t\t maxSize_.height < size.max.height) {\n-\t\t\t\tmaxSize_ = size.max;\n-\t\t\t\tmbusCode_ = mbusCode;\n-\t\t\t}\n-\t\t}\n-\t}\n-\tif (maxSize_.width == 0) {\n-\t\tLOG(IPU3, Info) << \"Sensor '\" << sensor_->entity()->name()\n-\t\t\t\t<< \"' detected, but no supported image format \"\n-\t\t\t\t<< \" found: skip camera creation\";\n-\t\treturn -ENODEV;\n-\t}\n-\n \tcsi2_ = new V4L2Subdevice(csi2Entity);\n \tret = csi2_->open();\n \tif (ret)\n@@ -1085,47 +1063,19 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n int CIO2Device::configure(const StreamConfiguration &config,\n \t\t\t V4L2DeviceFormat *outputFormat)\n {\n-\tunsigned int imageSize = config.width * config.height;\n-\tV4L2SubdeviceFormat sensorFormat = {};\n-\tunsigned int best = ~0;\n+\tV4L2SubdeviceFormat sensorFormat;\n \tint ret;\n \n-\tfor (auto it : sensor_->formats(0)) {\n-\t\t/* Only consider formats consumable by the CIO2 unit. */\n-\t\tif (mediaBusToFormat(it.first) < 0)\n-\t\t\tcontinue;\n-\n-\t\tfor (const SizeRange &size : it.second) {\n-\t\t\t/*\n-\t\t\t * Only select formats bigger than the requested sizes\n-\t\t\t * as the IPU3 cannot up-scale.\n-\t\t\t *\n-\t\t\t * \\todo: Unconditionally scale on the sensor as much\n-\t\t\t * as possible. This will need to be revisited when\n-\t\t\t * implementing the scaling policy.\n-\t\t\t */\n-\t\t\tif (size.max.width < config.width ||\n-\t\t\t size.max.height < config.height)\n-\t\t\t\tcontinue;\n-\n-\t\t\tunsigned int diff = size.max.width * size.max.height\n-\t\t\t\t\t - imageSize;\n-\t\t\tif (diff >= best)\n-\t\t\t\tcontinue;\n-\n-\t\t\tbest = diff;\n-\n-\t\t\tsensorFormat.width = size.max.width;\n-\t\t\tsensorFormat.height = size.max.height;\n-\t\t\tsensorFormat.mbus_code = it.first;\n-\t\t}\n-\t}\n-\n \t/*\n \t * Apply the selected format to the sensor, the CSI-2 receiver and\n \t * the CIO2 output device.\n \t */\n-\tret = sensor_->setFormat(0, &sensorFormat);\n+\tsensorFormat = sensor_->getFormat({ MEDIA_BUS_FMT_SBGGR10_1X10,\n+\t\t\t\t\t MEDIA_BUS_FMT_SGBRG10_1X10,\n+\t\t\t\t\t MEDIA_BUS_FMT_SGRBG10_1X10,\n+\t\t\t\t\t MEDIA_BUS_FMT_SRGGB10_1X10 },\n+\t\t\t\t\t Size(config.width, config.height));\n+\tret = sensor_->setFormat(&sensorFormat);\n \tif (ret)\n \t\treturn ret;\n \n", "prefixes": [ "libcamera-devel", "10/11" ] }