Patch Detail
Show a patch.
GET /api/patches/680/?format=api
{ "id": 680, "url": "https://patchwork.libcamera.org/api/patches/680/?format=api", "web_url": "https://patchwork.libcamera.org/patch/680/", "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": "<20190228200410.3022-3-jacopo@jmondi.org>", "date": "2019-02-28T20:04:02", "name": "[libcamera-devel,02/10] libcamera: ipu3: Get default image sizes from sensor", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ac606cd47b4473d62fab331b81f2ceff486eb1dc", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/680/mbox/", "series": [ { "id": 199, "url": "https://patchwork.libcamera.org/api/series/199/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=199", "date": "2019-02-28T20:04:00", "name": "libcamera: ipu3: ImgU support", "version": 1, "mbox": "https://patchwork.libcamera.org/series/199/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/680/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/680/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B8E64610BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 21:03:47 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4FDC3E0005;\n\tThu, 28 Feb 2019 20:03:47 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 28 Feb 2019 21:04:02 +0100", "Message-Id": "<20190228200410.3022-3-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190228200410.3022-1-jacopo@jmondi.org>", "References": "<20190228200410.3022-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 02/10] libcamera: ipu3: Get default image\n\tsizes from sensor", "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": "Thu, 28 Feb 2019 20:03:47 -0000" }, "content": "Inspect all image sizes provided by the sensor and select the\nbiggest one to be returned as default stream configuration instead of\nreturning the currently applied one.\n\nHardcode the stream pixel format to the one produced by the CIO2 unit,\nto be changed to the one provided by the ImgU.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 44 ++++++++++++++++++++--------\n 1 file changed, 32 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex d3f1d9a95f81..4f1ab72debf8 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -71,6 +71,8 @@ public:\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n+\tstatic constexpr unsigned int IPU3_BUF_NUM = 4;\n+\n \tIPU3CameraData *cameraData(const Camera *camera)\n \t{\n \t\treturn static_cast<IPU3CameraData *>(\n@@ -102,27 +104,45 @@ std::map<Stream *, StreamConfiguration>\n PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n \t\t\t\t\t std::vector<Stream *> &streams)\n {\n+\tstd::map<unsigned int, std::vector<SizeRange>> formats;\n \tstd::map<Stream *, StreamConfiguration> configs;\n \tIPU3CameraData *data = cameraData(camera);\n \tV4L2Subdevice *sensor = data->cio2.sensor;\n-\tV4L2SubdeviceFormat format = {};\n+\tStreamConfiguration *config = &configs[&data->stream_];\n+\n+\tconfig->pixelFormat = V4L2_PIX_FMT_IPU3_SGRBG10;\n+\tconfig->bufferCount = IPU3_BUF_NUM;\n \n \t/*\n-\t * FIXME: As of now, return the image format reported by the sensor.\n-\t * In future good defaults should be provided for each stream.\n+\t * Use the largest image size the sensor provides or\n+\t * use a default one.\n \t */\n-\tif (sensor->getFormat(0, &format)) {\n-\t\tLOG(IPU3, Error) << \"Failed to create stream configurations\";\n-\t\treturn configs;\n+\tformats = sensor->formats(0);\n+\tif (formats.empty()) {\n+\t\tconfig->width = 1920;\n+\t\tconfig->height = 1080;\n+\t\tLOG(IPU3, Info)\n+\t\t\t<< \"Use default stream sizes \" << config->width\n+\t\t\t<< \"x\" << config->height;\n \t}\n \n-\tStreamConfiguration config = {};\n-\tconfig.width = format.width;\n-\tconfig.height = format.height;\n-\tconfig.pixelFormat = V4L2_PIX_FMT_IPU3_SGRBG10;\n-\tconfig.bufferCount = 4;\n+\tauto it = formats.begin();\n+\twhile (it != formats.end()) {\n+\t\tfor (SizeRange &range : it->second) {\n+\t\t\tif (range.maxWidth <= config->width ||\n+\t\t\t range.maxHeight <= config->height)\n+\t\t\t\tcontinue;\n+\n+\t\t\tconfig->width = range.maxWidth;\n+\t\t\tconfig->height = range.maxHeight;\n+\t\t}\n+\n+\t\t++it;\n+\t}\n \n-\tconfigs[&data->stream_] = config;\n+\tLOG(IPU3, Info) << \"Stream format set to = (\" << config->width << \"x\"\n+\t\t\t<< config->height << \") - 0x\" << std::hex\n+\t\t\t<< config->pixelFormat;\n \n \treturn configs;\n }\n", "prefixes": [ "libcamera-devel", "02/10" ] }