Show a patch.

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

{
    "id": 10323,
    "url": "https://patchwork.libcamera.org/api/patches/10323/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10323/",
    "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": "<20201103155025.5948-3-laurent.pinchart@ideasonboard.com>",
    "date": "2020-11-03T15:50:20",
    "name": "[libcamera-devel,2/7] qcam: viewfinder_gl: Keep fragment shader when format doesn't change",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6fce1d42e1215dbfbe3178d11e9837d506c2d095",
    "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/10323/mbox/",
    "series": [
        {
            "id": 1441,
            "url": "https://patchwork.libcamera.org/api/series/1441/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1441",
            "date": "2020-11-03T15:50:18",
            "name": "qcam: Miscellaneous shaders cleanups and RGB support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1441/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10323/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10323/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 E3020BDB89\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  3 Nov 2020 15:51:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B66EF62BC9;\n\tTue,  3 Nov 2020 16:51:22 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D32C62B7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  3 Nov 2020 16:51:19 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E706FD7;\n\tTue,  3 Nov 2020 16:51:19 +0100 (CET)"
        ],
        "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=\"Yc0xpJBk\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1604418679;\n\tbh=FardDCZkpEqMXQU1/dKBmNrNAzq9W338e50vTQ1iJRw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Yc0xpJBkQsjR1KpoaI7tqkCQOk86KAFZ95HggFksgc4lcp9YW4IBvdL2B52HJmLPc\n\tEuMLGbor5Gr0xBOILyn0ZqRnLAABHznGxEsj+AS3wi/VukNj7B0YbYMNYm35p9yh5X\n\tYBaHjGKBZZG7k5226fkA41o0GRBnTvjn/0FlW9hc=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  3 Nov 2020 17:50:20 +0200",
        "Message-Id": "<20201103155025.5948-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201103155025.5948-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20201103155025.5948-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 2/7] qcam: viewfinder_gl: Keep fragment\n\tshader when format doesn't change",
        "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": "When ViewFinderGL::setFormat() is called, the fragment shader is deleted\nand recreated for the new format. This results in unnecessary shader\nrecompilation if only the size is changed and the pixel format remains\nthe same. Keep the existing shader in that case.\n\nThe null test for fragmentShader_ can be removed, as if the shader\nprogram is linked, the fragment shader is guaranteed to exist.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/viewfinder_gl.cpp | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex 03a576ba89d2..c07292523504 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -53,19 +53,23 @@ const QList<libcamera::PixelFormat> &ViewFinderGL::nativeFormats() const\n int ViewFinderGL::setFormat(const libcamera::PixelFormat &format,\n \t\t\t    const QSize &size)\n {\n-\t/* If the fragment is created remove it and create a new one. */\n-\tif (fragmentShader_) {\n+\tif (format != format_) {\n+\t\t/*\n+\t\t * If the fragment already exists, remove it and create a new\n+\t\t * one for the new format.\n+\t\t */\n \t\tif (shaderProgram_.isLinked()) {\n \t\t\tshaderProgram_.release();\n \t\t\tshaderProgram_.removeShader(fragmentShader_.get());\n \t\t\tfragmentShader_.reset();\n \t\t}\n+\n+\t\tif (!selectFormat(format))\n+\t\t\treturn -1;\n+\n+\t\tformat_ = format;\n \t}\n \n-\tif (!selectFormat(format))\n-\t\treturn -1;\n-\n-\tformat_ = format;\n \tsize_ = size;\n \n \tupdateGeometry();\n",
    "prefixes": [
        "libcamera-devel",
        "2/7"
    ]
}