Show a patch.

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

{
    "id": 9644,
    "url": "https://patchwork.libcamera.org/api/patches/9644/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9644/",
    "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": "<20200917112839.5099-1-jacopo@jmondi.org>",
    "date": "2020-09-17T11:28:39",
    "name": "[libcamera-devel] libcamera: ipu3: Always use sensor full frame size",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a794b0ae7cbda85bf59d9b23537c9a55b073315b",
    "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/9644/mbox/",
    "series": [
        {
            "id": 1294,
            "url": "https://patchwork.libcamera.org/api/series/1294/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1294",
            "date": "2020-09-17T11:28:39",
            "name": "[libcamera-devel] libcamera: ipu3: Always use sensor full frame size",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1294/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9644/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9644/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 94F7AC3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Sep 2020 11:24:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 435506036C;\n\tThu, 17 Sep 2020 13:24:55 +0200 (CEST)",
            "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D19DE6036A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Sep 2020 13:24:53 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 448DC24000D;\n\tThu, 17 Sep 2020 11:24:51 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 17 Sep 2020 13:28:39 +0200",
        "Message-Id": "<20200917112839.5099-1-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.28.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] libcamera: ipu3: Always use sensor full\n\tframe 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>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When calculating the pipeline configuration for the IPU3 platform,\nlibcamera tries to be smart and select the smallest sensor frame\nresolution larger enough to accommodate the stream sizes\nrequested by the application.\n\nWhile this seems to make a lot of sense, in practice optimizing the\nselected sensor resolution makes the pipeline configuration calculation\nprocess fail in multiple occasions, or results in stalls during capture.\n\nAs a trivial example, capturing with cam with the following command\nline results in a stall:\n$ cam -swidth=1280,height=720 -swidth=640,height=480 -c1 -C\n\nLikewise, the Android HAL supported format enumeration fails in\nreporting smaller resolutions as supported when used with the OV5670\nsensor.\n\n320x240:\nDEBUG IPU3 ipu3.cpp:192 CIO2 configuration: 648x486-SGRBG10_IPU3\nERROR IPU3 imgu.cpp:408 Failed to calculate pipe configuration\nERROR IPU3 ipu3.cpp:299 Failed to calculate pipe configuration: unsupported resolutions.\n\n640x480:\nDEBUG IPU3 ipu3.cpp:192 CIO2 configuration: 320x240-SGRBG10_IPU3\nERROR IPU3 imgu.cpp:408 Failed to calculate pipe configuration\nERROR IPU3 ipu3.cpp:299 Failed to calculate pipe configuration: unsupported resolutions.\n\nFurthermore the reference xml files used for the IPU3 camera\nconfiguration on the ChromeOS platform restricts the number of sensor\nresolution to be used for the OV5670 sensor to 2 from the 6 supported by\nthe driver [1].\n\nThe selection criteria of the correct CIO2 mode are not specified, and\nfor the time being, always use the sensor maximum resolution at the\nexpense of frame rate and bus bandwidth to allow the pipeline to successfully\nsupport smaller modes for the OV5670 sensor and solves pipeline stalls\nwhen capturing with both sensors.\n\n[1] See the <sensor_modes> enumeration in:\nhttps://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/baseboard-poppy/media-libs/cros-camera-hal-configs-poppy/files/gcss/graph_settings_ov5670.xml\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nRFC->v1:\n- Add Niklas' tag\n- Expand the \\todo comment and remove the existing comment block\n\nJust have a look at the \\todo block wording, if no big questions I'll push this\none soon.\n\nThanks\n  j\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 31 ++++++++++++----------------\n 1 file changed, 13 insertions(+), 18 deletions(-)\n\n--\n2.28.0",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 2d881fe28f98..2ba00a2ca211 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -144,25 +144,16 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t\tstatus = Adjusted;\n \t}\n\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, as the IPU3 can downscale only. If\n-\t * no resolution is requested for the RAW stream, use the one from the\n-\t * largest YUV stream, plus margins pixels for the IF and BDS to scale.\n-\t * If no resolution is requested for any stream, pick the largest one.\n-\t */\n+\t/* Validate the requested stream configuration */\n \tunsigned int rawCount = 0;\n \tunsigned int yuvCount = 0;\n \tSize maxYuvSize;\n-\tSize maxRawSize;\n\n \tfor (const StreamConfiguration &cfg : config_) {\n \t\tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);\n\n \t\tif (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {\n \t\t\trawCount++;\n-\t\t\tmaxRawSize.expandTo(cfg.size);\n \t\t} else {\n \t\t\tyuvCount++;\n \t\t\tmaxYuvSize.expandTo(cfg.size);\n@@ -174,18 +165,22 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t\treturn Invalid;\n \t}\n\n-\tif (maxRawSize.isNull())\n-\t\tmaxRawSize = maxYuvSize.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-\n \t/*\n \t * Generate raw configuration from CIO2.\n \t *\n-\t * The output YUV streams will be limited in size to the maximum\n-\t * frame size requested for the RAW stream.\n+\t * \\todo The image sensor frame size should be calculated as the\n+\t * smallest possible resolution larger enough to accommodate the\n+\t * requested stream sizes. However such a selection makes the pipeline\n+\t * configuration procedure fail for small resolution (in example:\n+\t * 640x480 with OV5670) and causes the capture operations to stall for\n+\t * some streams size combinations (see the commit message of the patch\n+\t * that introduced this comment for more failure examples).\n+\t *\n+\t * Until the sensor frame size calculation criteria are not clarified,\n+\t * always use the largest possible one which guarantees better results\n+\t * at the expense of the frame rate and CSI-2 bus bandwidth.\n \t */\n-\tcio2Configuration_ = data_->cio2_.generateConfiguration(maxRawSize);\n+\tcio2Configuration_ = data_->cio2_.generateConfiguration({});\n \tif (!cio2Configuration_.pixelFormat.isValid())\n \t\treturn Invalid;\n\n",
    "prefixes": [
        "libcamera-devel"
    ]
}