Show a patch.

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

{
    "id": 18858,
    "url": "https://patchwork.libcamera.org/api/patches/18858/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18858/",
    "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": "<20230721093759.27700-2-naush@raspberrypi.com>",
    "date": "2023-07-21T09:37:56",
    "name": "[libcamera-devel,v1,1/4] pipeline: rpi: Increase buffer import count to 32",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4fa4c12e190315e1dd1b96c095345949d826acaf",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18858/mbox/",
    "series": [
        {
            "id": 3980,
            "url": "https://patchwork.libcamera.org/api/series/3980/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3980",
            "date": "2023-07-21T09:37:55",
            "name": "Raspberry Pi: External buffer handling",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3980/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18858/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18858/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 B9BC8BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Jul 2023 09:38:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6BED628C7;\n\tFri, 21 Jul 2023 11:37:59 +0200 (CEST)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 343DB628BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jul 2023 11:37:58 +0200 (CEST)",
            "by mail-wm1-x32b.google.com with SMTP id\n\t5b1f17b1804b1-3fbc244d307so15121305e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jul 2023 02:37:58 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn12-20020a5d6b8c000000b003143c6e09ccsm3674663wrx.16.2023.07.21.02.37.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 21 Jul 2023 02:37:57 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689932279;\n\tbh=+1abu2ZKXVHcKBycKbIcq2Dj3X4qqFlh1KD19PfbJzs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=PUPLmqMMoYAlIoNqbUHRiSS+3mEtGxc+kGeb8IoBcRYQtdGLCJU9IN0UYaAiiM6h2\n\t7zF0X/HHh2tjrgKzZ8wxaBNz134s31fN/dUEOzgGIgiRQu9FOFg9LJj/Ul2rVQRjsg\n\tBMsvXsK2Hgb7MetKG0mOIUG/L7+Of4W081XuUpz83jP/mlFGzQGhKcrjZMv412Wz+h\n\tvakIBAqiSnOONCmarxUxcQSXmwwG9H0CfrGSNQbiWpoxBNFp8nPz5xtRSLq5ySZBCS\n\thh86e6tFV6QBRzG4fNeTaALAzWcAORgxWclYbajlLCljiUQBut4AKRA0ikvwPwADTW\n\trRk+YeCMGbUiQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1689932277; x=1690537077;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=iEcMesmSrHM3jxC8V6CtQRJa/y3x1n2+cCaiHMom00k=;\n\tb=CmkVxbI1cCZQu6TXHvplhKxgvL2OJ+soWcLmRucShi4ygXHBWHpIopEhOO65dIk01U\n\tApCfLHZai3aQyPqBLe3vk/7cfKTCL6PEWtTrV6JvrVLhELWrwaUJSUMRSFgSY/3QVPXz\n\td1+1Bl2DWlMTDbrKsihG1jW/ZibmjOQRKsFSmLxutYtdkDnHw/PZFF7JFB9p3ERL26c6\n\tQfD7C6NGb/LnnMIMEuRYbepnflkiCAhvwd7XOc/Go1A5xTklTIT9hj+YJm0WbXrW0AkI\n\t3PbLq53+6uTFE0J7m5dnttp8oweIRIT9yKn/AAqmAB15K6JTsWjOZttrnW3T3h15Z+6n\n\t+3Kg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"CmkVxbI1\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1689932277; x=1690537077;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=iEcMesmSrHM3jxC8V6CtQRJa/y3x1n2+cCaiHMom00k=;\n\tb=HU8VQ72Y9jtdiO8t2XTSL7vO/i0SUSczNUSDiKtAB2+jG3H1Q5BvCu9qmU2KZPfQ4n\n\tcA6akGHDUiuic5nj2V8Yq4GZWoxUBsi+0OnHsmAYK4UsfJ+2J64lrv9/fKatCOBm+TB6\n\tnuMr/Z+3vbYBb8PjIkhaebvpo3fKjIvncrfExb3yaHcH2r4DPOngxyovi99yaJdz458d\n\tQ5/+G2AmCR8UW7ubPkjNAVo1TTX65l+0UNgiv8eQ90uiQ9SdmkvkeFllesHbUQoyJ2GT\n\tPgFll9/Reb7zrphpyP9AMKi+SaO92SZlDm8FEqIcEvP4dNSh91xwvs+ALayDIV1C+6Gl\n\t9yTw==",
        "X-Gm-Message-State": "ABy/qLYnPZ2M2ZN1BMt9UKSq1hJeejek4xYYqtWwGdUa4NzPBbKrG8D7\n\tG9rH2uDpv6kyKTAJK/S9TkjtBsdluo/1yCGXLDUS+Q==",
        "X-Google-Smtp-Source": "APBJJlF6zvUJkBUpYYyVDeUsUCLiMt0Kp7qs6TeNsCzg9uizOhas7jlg7Hnt5QNyWH+qWTKCTq0AnQ==",
        "X-Received": "by 2002:a1c:7c0b:0:b0:3fb:9ea6:7a73 with SMTP id\n\tx11-20020a1c7c0b000000b003fb9ea67a73mr1038405wmc.23.1689932277448; \n\tFri, 21 Jul 2023 02:37:57 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 21 Jul 2023 10:37:56 +0100",
        "Message-Id": "<20230721093759.27700-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230721093759.27700-1-naush@raspberrypi.com>",
        "References": "<20230721093759.27700-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 1/4] pipeline: rpi: Increase buffer\n\timport count to 32",
        "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>",
        "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Hardcode the maximum number of buffers imported to the V4L2 video device\nto 32. This only has a minor disadvantage of over-allocating cache slots\nand V4L2 buffer indexes, but does allow more headroom for using dma\nbuffers allocated from outside of libcamera.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/rpi/common/rpi_stream.cpp        | 35 +++++--------------\n 1 file changed, 9 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\nindex c158843cb0ed..1d05c5acc0d9 100644\n--- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\n+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\n@@ -94,35 +94,18 @@ int Stream::prepareBuffers(unsigned int count)\n {\n \tint ret;\n \n-\tif (!(flags_ & StreamFlag::ImportOnly)) {\n-\t\tif (count) {\n-\t\t\t/* Export some frame buffers for internal use. */\n-\t\t\tret = dev_->exportBuffers(count, &internalBuffers_);\n-\t\t\tif (ret < 0)\n-\t\t\t\treturn ret;\n-\n-\t\t\t/* Add these exported buffers to the internal/external buffer list. */\n-\t\t\tsetExportedBuffers(&internalBuffers_);\n-\t\t\tresetBuffers();\n-\t\t}\n+\tif (!(flags_ & StreamFlag::ImportOnly) && count) {\n+\t\t/* Export some frame buffers for internal use. */\n+\t\tret = dev_->exportBuffers(count, &internalBuffers_);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n \n-\t\t/* We must import all internal/external exported buffers. */\n-\t\tcount = bufferMap_.size();\n+\t\t/* Add these exported buffers to the internal/external buffer list. */\n+\t\tsetExportedBuffers(&internalBuffers_);\n+\t\tresetBuffers();\n \t}\n \n-\t/*\n-\t * If this is an external stream, we must allocate slots for buffers that\n-\t * might be externally allocated. We have no indication of how many buffers\n-\t * may be used, so this might overallocate slots in the buffer cache.\n-\t * Similarly, if this stream is only importing buffers, we do the same.\n-\t *\n-\t * \\todo Find a better heuristic, or, even better, an exact solution to\n-\t * this issue.\n-\t */\n-\tif ((flags_ & StreamFlag::External) || (flags_ & StreamFlag::ImportOnly))\n-\t\tcount = count * 2;\n-\n-\treturn dev_->importBuffers(count);\n+\treturn dev_->importBuffers(32);\n }\n \n int Stream::queueBuffer(FrameBuffer *buffer)\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "1/4"
    ]
}