Show a patch.

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

{
    "id": 3264,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3264/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3264/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200323142205.28342-22-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-23T14:22:05",
    "name": "[libcamera-devel,21/21] qcam: viewfinder: Add support for more native formats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5ec6fdc5448d40cbeecd4eab7079c22b67c7cf61",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3264/mbox/",
    "series": [
        {
            "id": 760,
            "url": "https://patchwork.libcamera.org/api/1.1/series/760/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=760",
            "date": "2020-03-23T14:21:44",
            "name": "qcam: Bypass format conversion when not required",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/760/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3264/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3264/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D8F5962C71\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:25 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 75D48A31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:25 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584973345;\n\tbh=rOfyiGMGR0blr8uRS6jkzcG5eo47D2SsKERhXaNODds=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Fs4oRh73j3RUuyoKFwvTeS3oQ1zNZKkEX8kJf1Or7cqTjMd7Wf1kbyCDdmxT8YCB8\n\tNgBQc5uPqQ/0QVgOa777jHwd3roDJo0MKsVJpqNkTSiuDB5ayRpZM1xWqr3WU2szZh\n\tioiroaSoTGvgwSak817xcOQVtXT4dOU5MCPAO6AU=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Mar 2020 16:22:05 +0200",
        "Message-Id": "<20200323142205.28342-22-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 21/21] qcam: viewfinder: Add support for\n\tmore native formats",
        "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>",
        "X-List-Received-Date": "Mon, 23 Mar 2020 14:22:29 -0000"
    },
    "content": "Qt supports more 24-bit and 32-bit RGB formats for native painting.\nDisable the converter and create a QImage in the appropriate format.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/viewfinder.cpp | 16 +++++++++++++---\n 1 file changed, 13 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\nindex a40b2b400daa..e5cfa45fc662 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder.cpp\n@@ -7,16 +7,26 @@\n \n #include \"viewfinder.h\"\n \n+#include <stdint.h>\n #include <utility>\n \n #include <QImage>\n #include <QImageWriter>\n+#include <QMap>\n #include <QMutexLocker>\n #include <QPainter>\n #include <QtDebug>\n \n #include \"format_converter.h\"\n \n+static const QMap<uint32_t, QImage::Format> formats{\n+\t{ DRM_FORMAT_ARGB8888, QImage::Format_RGB32 },\n+\t{ DRM_FORMAT_RGB888, QImage::Format_RGB888 },\n+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))\n+\t{ DRM_FORMAT_BGR888, QImage::Format_BGR888 },\n+#endif\n+};\n+\n ViewFinder::ViewFinder(QWidget *parent)\n \t: QWidget(parent), buffer_(nullptr)\n {\n@@ -36,7 +46,7 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n \t * If format conversion is needed, configure the converter and allocate\n \t * the destination image.\n \t */\n-\tif (format != DRM_FORMAT_ARGB8888) {\n+\tif (!formats.contains(format)) {\n \t\tint ret = converter_.configure(format, size);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n@@ -64,7 +74,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t{\n \t\tQMutexLocker locker(&mutex_);\n \n-\t\tif (format_ == DRM_FORMAT_ARGB8888) {\n+\t\tif (formats.contains(format_)) {\n \t\t\t/*\n \t\t\t * If the frame format is identical to the display\n \t\t\t * format, create a QImage that references the frame\n@@ -73,7 +83,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\t\t * released.\n \t\t\t */\n \t\t\timage_ = QImage(memory, size_.width(), size_.height(),\n-\t\t\t\t\tsize / size_.height(), QImage::Format_RGB32);\n+\t\t\t\t\tsize / size_.height(), formats[format_]);\n \t\t\tstd::swap(buffer, buffer_);\n \t\t} else {\n \t\t\t/*\n",
    "prefixes": [
        "libcamera-devel",
        "21/21"
    ]
}