Show a patch.

GET /api/1.1/patches/14085/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14085,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14085/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14085/",
    "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": "<20211011151154.72856-2-jacopo@jmondi.org>",
    "date": "2021-10-11T15:11:39",
    "name": "[libcamera-devel,v3,01/16] libcamera: ipu3: Use the optimal sensor size",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6fba5f6b9e0afde8c8fff64ed0b314823fc4dcd8",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14085/mbox/",
    "series": [
        {
            "id": 2613,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2613/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2613",
            "date": "2021-10-11T15:11:38",
            "name": "IPU3 control info update and HAL frame durations",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2613/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14085/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14085/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 23E13C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Oct 2021 15:11:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 668BC68F4C;\n\tMon, 11 Oct 2021 17:11:13 +0200 (CEST)",
            "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 28BCB6012B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Oct 2021 17:11:11 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 46F3FE0003;\n\tMon, 11 Oct 2021 15:11:10 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 11 Oct 2021 17:11:39 +0200",
        "Message-Id": "<20211011151154.72856-2-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20211011151154.72856-1-jacopo@jmondi.org>",
        "References": "<20211011151154.72856-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 01/16] libcamera: ipu3: Use the optimal\n\tsensor size",
        "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": "As reported by commit 7208e70211a6 (\"libcamera: ipu3: Always use sensor\nfull frame size\") the current implementation of the IPU3 pipeline\nhandler always uses the sensor resolution as the ImgU input frame size in\norder to work around an issue with the ImgU configuration procedure.\n\nNow that the frame selection policy has been modified in the CIO2Device\nclass implementation to comply with the requirements of the ImgU\nconfiguration script we can remove the workaround and select the most\nopportune sensor size to feed the ImgU with.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 41 ++++++++++++++++------------\n 1 file changed, 23 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 92e869257e53..5b2ab2ee6825 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -229,7 +229,16 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t\tstatus = Adjusted;\n \t}\n \n-\t/* Validate the requested stream configuration */\n+\t/*\n+\t * Validate the requested stream configuration and select the sensor\n+\t * format by collecting the maximum RAW stream width and height and\n+\t * picking the closest larger match.\n+\t *\n+\t * If no RAW stream is requested use the one of the largest YUV stream,\n+\t * plus margin pixels for the IF and BDS rectangle to downscale.\n+\t *\n+\t * \\todo Clarify the IF and BDS margins requirements.\n+\t */\n \tunsigned int rawCount = 0;\n \tunsigned int yuvCount = 0;\n \tSize maxYuvSize;\n@@ -240,7 +249,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \n \t\tif (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {\n \t\t\trawCount++;\n-\t\t\trawSize = cfg.size;\n+\t\t\trawSize.expandTo(cfg.size);\n \t\t} else {\n \t\t\tyuvCount++;\n \t\t\tmaxYuvSize.expandTo(cfg.size);\n@@ -269,24 +278,20 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t/*\n \t * Generate raw configuration from CIO2.\n \t *\n-\t * \\todo The image sensor frame size should be selected to optimize\n-\t * operations based on the sizes of the requested streams. However such\n-\t * a selection makes the pipeline configuration procedure fail for small\n-\t * resolutions (for example: 640x480 with OV5670) and causes the capture\n-\t * operations to stall for some stream size combinations (see the\n-\t * commit message of the patch that introduced this comment for more\n-\t * failure examples).\n+\t * The output YUV streams will be limited in size to the maximum frame\n+\t * size requested for the RAW stream, if present.\n \t *\n-\t * Until the sensor frame size calculation criteria are clarified, when\n-\t * capturing from ImgU always use the largest possible size which\n-\t * guarantees better results at the expense of the frame rate and CSI-2\n-\t * bus bandwidth. When only a raw stream is requested use the requested\n-\t * size instead, as the ImgU is not involved.\n+\t * If no raw stream is requested generate a size as large as the maximum\n+\t * requested YUV size aligned to the ImgU constraints and bound by the\n+\t * sensor's maximum resolution. See\n+\t * https://bugs.libcamera.org/show_bug.cgi?id=32\n \t */\n-\tif (!yuvCount)\n-\t\tcio2Configuration_ = data_->cio2_.generateConfiguration(rawSize);\n-\telse\n-\t\tcio2Configuration_ = data_->cio2_.generateConfiguration({});\n+\tif (rawSize.isNull())\n+\t\trawSize = maxYuvSize.expandedTo({40, 540})\n+\t\t\t\t    .alignedUpTo(IMGU_OUTPUT_WIDTH_MARGIN,\n+\t\t\t\t\t\t IMGU_OUTPUT_HEIGHT_MARGIN)\n+\t\t\t\t    .boundedTo(data_->cio2_.sensor()->resolution());\n+\tcio2Configuration_ = data_->cio2_.generateConfiguration(rawSize);\n \tif (!cio2Configuration_.pixelFormat.isValid())\n \t\treturn Invalid;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "01/16"
    ]
}