Show a patch.

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

{
    "id": 13704,
    "url": "https://patchwork.libcamera.org/api/patches/13704/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13704/",
    "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": "<20210907002044.7319-2-laurent.pinchart@ideasonboard.com>",
    "date": "2021-09-07T00:20:40",
    "name": "[libcamera-devel,v2,1/5] qcam: viewfinder: Pass stride value to viewfinder",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3c3827a130157f20e3180a0803ef73e8956a60e4",
    "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/13704/mbox/",
    "series": [
        {
            "id": 2484,
            "url": "https://patchwork.libcamera.org/api/series/2484/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2484",
            "date": "2021-09-07T00:20:39",
            "name": "qcam: Fix stride handling",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2484/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13704/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13704/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 C9A2FBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 00:21:13 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C0AF069178;\n\tTue,  7 Sep 2021 02:21:10 +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 A563069167\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 02:21:07 +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 3D124993\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 02:21:07 +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=\"mYu+n1A1\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630974067;\n\tbh=62WmNlGgrpwlRornY2x0Y+b25WlZ4o246XoUY+EFKw8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=mYu+n1A1JAY3mRAo1F/l/sVbLLrQ6UhjiDODIOKxbEcUewkP2hTAIDk7938E1E0SN\n\t2P9XznVbNizlzwscKJtUYxfA5o6uDHh9oZaMhyK8RwcPB/9IgPnDTTy64bb1Wz8gKK\n\tR9Q5S8GcTUXFBgSSvKG43YJ19MzhPw5VNnnzJXYU=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  7 Sep 2021 03:20:40 +0300",
        "Message-Id": "<20210907002044.7319-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210907002044.7319-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210907002044.7319-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/5] qcam: viewfinder: Pass stride\n\tvalue to viewfinder",
        "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": "qcam currently assumes that no padding is used at end of lines, and uses\nthe image width as the stride. This leads to rendering failures with\nsome formats on some platforms. To prepare for stride support, add a\nstride parameter to the ViewFinder::setFormat() function to pass the\nstride from the stream configuration to the viewfinder.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/main_window.cpp   | 3 ++-\n src/qcam/viewfinder.h      | 3 ++-\n src/qcam/viewfinder_gl.cpp | 7 ++-----\n src/qcam/viewfinder_gl.h   | 3 ++-\n src/qcam/viewfinder_qt.cpp | 3 ++-\n src/qcam/viewfinder_qt.h   | 3 ++-\n 6 files changed, 12 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 168dd5ce30e3..bb6b03993add 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -448,7 +448,8 @@ int MainWindow::startCapture()\n \n \t/* Configure the viewfinder. */\n \tret = viewfinder_->setFormat(vfConfig.pixelFormat,\n-\t\t\t\t     QSize(vfConfig.size.width, vfConfig.size.height));\n+\t\t\t\t     QSize(vfConfig.size.width, vfConfig.size.height),\n+\t\t\t\t     vfConfig.stride);\n \tif (ret < 0) {\n \t\tqInfo() << \"Failed to set viewfinder format\";\n \t\treturn ret;\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex fb462835fb5f..4c2102a6ed04 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -23,7 +23,8 @@ public:\n \n \tvirtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0;\n \n-\tvirtual int setFormat(const libcamera::PixelFormat &format, const QSize &size) = 0;\n+\tvirtual int setFormat(const libcamera::PixelFormat &format, const QSize &size,\n+\t\t\t      unsigned int stride) = 0;\n \tvirtual void render(libcamera::FrameBuffer *buffer, Image *image) = 0;\n \tvirtual void stop() = 0;\n \ndiff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex 32232faa2ad8..aeb1ea02d2d5 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -72,7 +72,7 @@ const QList<libcamera::PixelFormat> &ViewFinderGL::nativeFormats() const\n }\n \n int ViewFinderGL::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t    const QSize &size)\n+\t\t\t    const QSize &size, unsigned int stride)\n {\n \tif (format != format_) {\n \t\t/*\n@@ -92,6 +92,7 @@ int ViewFinderGL::setFormat(const libcamera::PixelFormat &format,\n \t}\n \n \tsize_ = size;\n+\tstride_ = stride;\n \n \tupdateGeometry();\n \treturn 0;\n@@ -119,10 +120,6 @@ void ViewFinderGL::render(libcamera::FrameBuffer *buffer, Image *image)\n \t\trenderComplete(buffer_);\n \n \timage_ = image;\n-\t/*\n-\t * \\todo Get the stride from the buffer instead of computing it naively\n-\t */\n-\tstride_ = buffer->metadata().planes()[0].bytesused / size_.height();\n \tupdate();\n \tbuffer_ = buffer;\n }\ndiff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\nindex 72a60ecb9159..2b2b1e86035a 100644\n--- a/src/qcam/viewfinder_gl.h\n+++ b/src/qcam/viewfinder_gl.h\n@@ -38,7 +38,8 @@ public:\n \n \tconst QList<libcamera::PixelFormat> &nativeFormats() const override;\n \n-\tint setFormat(const libcamera::PixelFormat &format, const QSize &size) override;\n+\tint setFormat(const libcamera::PixelFormat &format, const QSize &size,\n+\t\t      unsigned int stride) override;\n \tvoid render(libcamera::FrameBuffer *buffer, Image *image) override;\n \tvoid stop() override;\n \ndiff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp\nindex 0d357d860014..cd051760160c 100644\n--- a/src/qcam/viewfinder_qt.cpp\n+++ b/src/qcam/viewfinder_qt.cpp\n@@ -52,7 +52,8 @@ const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const\n }\n \n int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t    const QSize &size)\n+\t\t\t    const QSize &size,\n+\t\t\t    [[maybe_unused]] unsigned int stride)\n {\n \timage_ = QImage();\n \ndiff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h\nindex 6b48ef48a7d1..756f3fa33055 100644\n--- a/src/qcam/viewfinder_qt.h\n+++ b/src/qcam/viewfinder_qt.h\n@@ -31,7 +31,8 @@ public:\n \n \tconst QList<libcamera::PixelFormat> &nativeFormats() const override;\n \n-\tint setFormat(const libcamera::PixelFormat &format, const QSize &size) override;\n+\tint setFormat(const libcamera::PixelFormat &format, const QSize &size,\n+\t\t      unsigned int stride) override;\n \tvoid render(libcamera::FrameBuffer *buffer, Image *image) override;\n \tvoid stop() override;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/5"
    ]
}