Show a patch.

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

{
    "id": 11402,
    "url": "https://patchwork.libcamera.org/api/patches/11402/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11402/",
    "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": "<20210226132932.165484-10-jacopo@jmondi.org>",
    "date": "2021-02-26T13:29:29",
    "name": "[libcamera-devel,09/12] android: jpeg: Use maxJpegBufferSize() for compatibility",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2df669c1c295849f0a2d0ef7700eb033bcd7f22a",
    "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/11402/mbox/",
    "series": [
        {
            "id": 1731,
            "url": "https://patchwork.libcamera.org/api/series/1731/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1731",
            "date": "2021-02-26T13:29:20",
            "name": "android: Support memory backends",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1731/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11402/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11402/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 4175EBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Feb 2021 13:29:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F19C68A82;\n\tFri, 26 Feb 2021 14:29:23 +0100 (CET)",
            "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE92468A76\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Feb 2021 14:29:16 +0100 (CET)",
            "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id B22A7200005\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Feb 2021 13:29:16 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 26 Feb 2021 14:29:29 +0100",
        "Message-Id": "<20210226132932.165484-10-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20210226132932.165484-1-jacopo@jmondi.org>",
        "References": "<20210226132932.165484-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 09/12] android: jpeg: Use\n\tmaxJpegBufferSize() for compatibility",
        "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=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Platforms that do not provide a memory backend implementation should\nkeep using the maxJpegBufferSize() value to calculate the location where\nto place the JPEG blob id, as the android_generic backend returns the\nallocated buffer size as calculated using lseek which is larger than\nthe maximum JPEG frame size, which is where the framework expects the\nJPEG blob to be placed.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/jpeg/post_processor_jpeg.cpp | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex d6eeb962e81d..e7f66d66698c 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -185,9 +185,17 @@ int PostProcessorJpeg::process(const FrameBuffer &source,\n \t}\n \n \t/* Fill in the JPEG blob header. */\n-\tuint8_t *resultPtr = destination->plane(0) +\n-\t\t\t     destination->planeSize(0) -\n-\t\t\t     sizeof(struct camera3_jpeg_blob);\n+\t/*\n+\t * \\todo For backward compatibility reasons with the android_generic\n+\t * memory backend, continue using the maxJpegBufferSize in case the\n+\t * computed buffer size is larger. This can be dropped once all\n+\t * supported platforms will have a working memory backend that\n+\t * returns the correct buffer size.\n+\t */\n+\tsize_t blobSize = std::min<unsigned int>(cameraDevice_->maxJpegBufferSize(),\n+\t\t\t\t\t\t destination->planeSize(0));\n+\tuint8_t *resultPtr = destination->plane(0) + blobSize\n+\t\t\t   - sizeof(struct camera3_jpeg_blob);\n \tauto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr);\n \tblob->jpeg_blob_id = CAMERA3_JPEG_BLOB_ID;\n \tblob->jpeg_size = jpeg_size;\n",
    "prefixes": [
        "libcamera-devel",
        "09/12"
    ]
}