Patch Detail
Show a patch.
GET /api/patches/12475/?format=api
{ "id": 12475, "url": "https://patchwork.libcamera.org/api/patches/12475/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12475/", "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": "<20210531020745.13815-3-laurent.pinchart@ideasonboard.com>", "date": "2021-05-31T02:07:45", "name": "[libcamera-devel,2/2] libcamera: pipeline: ipu3: Fix incorrect bdsHeight calculation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "77acb99773ac199c3290cefec6d7e39cf424af6e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12475/mbox/", "series": [ { "id": 2094, "url": "https://patchwork.libcamera.org/api/series/2094/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2094", "date": "2021-05-31T02:07:43", "name": "Fix gcc warning in IPU3 pipeline handler", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2094/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12475/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12475/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 88921C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 May 2021 02:08:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49EB168925;\n\tMon, 31 May 2021 04:08:03 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DCA596891F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 May 2021 04:07:58 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D1AC8AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 May 2021 04:07:58 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wZKefelj\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622426878;\n\tbh=dxroh8JJ3hkJJ1GOwoNC6PmbOq3TRCcdIto7Flhd0qI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=wZKefeljbUOk9IAA5f0GM7CAbYD7OPmLHmIuIKhGMpdnzL9WSjtk+Oe7WRvJLhzDa\n\tKdduM6eFfkDt+fpPZcDzmja3ooO9W9topLDFlELRSP65Ce/9LSczCJPx8hzqGDTlYx\n\tbsv3LSu0BuKpfqmCdr6o9p1K7naEpFeZ+R18wsQE=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 31 May 2021 05:07:45 +0300", "Message-Id": "<20210531020745.13815-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210531020745.13815-1-laurent.pinchart@ideasonboard.com>", "References": "<20210531020745.13815-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: pipeline: ipu3: Fix\n\tincorrect bdsHeight calculation", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "When compiling with optimization, gcc 9 and newer throw an unitialized\nvariable warning:\n\n../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’:\n../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n 172 | unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n\nNeither clang not gcc versions older than 9 complain. This seems to be\na false positive.\n\nHowever, there's an obvious error in the code. The second while () loop\nin the first part of calculateBDSHeight() modifies the bdsHeight\nvariable set by the first loop even if the second loop doesn't find a\nsuitable height. This can result in an incorrect bdsHeight value. Fix\nthis, which also gets rid of the compiler warning.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/imgu.cpp | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\nindex 3e517ac67962..4eb3f7b730a9 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.cpp\n+++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n@@ -138,12 +138,13 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n \t\twhile (ifHeight >= minIFHeight && ifHeight <= iif.height &&\n \t\t ifHeight / bdsSF >= minBDSHeight) {\n \n-\t\t\tbdsHeight = ifHeight / bdsSF;\n-\t\t\tif (std::fmod(bdsHeight, 1.0) == 0) {\n-\t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n+\t\t\tfloat height = ifHeight / bdsSF;\n+\t\t\tif (std::fmod(height, 1.0) == 0) {\n+\t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(height);\n \n \t\t\t\tif (!(bdsIntHeight % BDS_ALIGN_H)) {\n \t\t\t\t\tfoundIfHeight = ifHeight;\n+\t\t\t\t\tbdsHeight = height;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t}\n@@ -155,12 +156,13 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n \t\twhile (ifHeight >= minIFHeight && ifHeight <= iif.height &&\n \t\t ifHeight / bdsSF >= minBDSHeight) {\n \n-\t\t\tbdsHeight = ifHeight / bdsSF;\n-\t\t\tif (std::fmod(bdsHeight, 1.0) == 0) {\n-\t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n+\t\t\tfloat height = ifHeight / bdsSF;\n+\t\t\tif (std::fmod(height, 1.0) == 0) {\n+\t\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(height);\n \n \t\t\t\tif (!(bdsIntHeight % BDS_ALIGN_H)) {\n \t\t\t\t\tfoundIfHeight = ifHeight;\n+\t\t\t\t\tbdsHeight = height;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t}\n", "prefixes": [ "libcamera-devel", "2/2" ] }