Patch Detail
Show a patch.
GET /api/1.1/patches/3297/?format=api
{ "id": 3297, "url": "https://patchwork.libcamera.org/api/1.1/patches/3297/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3297/", "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": "<20200324103012.9678-1-laurent.pinchart@ideasonboard.com>", "date": "2020-03-24T10:30:11", "name": "[libcamera-devel,1/2] qcam: viewfinder: Report the natively supported pixel formats", "commit_ref": "8bd4f20193abafdd8bc25b9b0d37a0aced8aa2cb", "pull_url": null, "state": "accepted", "archived": false, "hash": "fcee77ff1a8637867c69764b457aeda3d3740a97", "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/3297/mbox/", "series": [ { "id": 768, "url": "https://patchwork.libcamera.org/api/1.1/series/768/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=768", "date": "2020-03-24T10:30:12", "name": "[libcamera-devel,1/2] qcam: viewfinder: Report the natively supported pixel formats", "version": 1, "mbox": "https://patchwork.libcamera.org/series/768/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3297/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3297/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "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 F1D0C62BDE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2020 11:30:18 +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 85EB1308\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2020 11:30:17 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585045817;\n\tbh=fCBOSUe9Xb/5vxvc3OefPlQ+LElKxKLq28eVF7vKRdk=;\n\th=From:To:Subject:Date:From;\n\tb=NG3XPtFGViah3PSISrowMrRVhILXXrHIAKIRP2Z8IfyM3iAxwtX3b42PL4P+n9yw5\n\tX7A9N67C5Ph4g3BVdrEKSjFccKOFWLqG5Fjw4gJA9khjY0uirjfwypAaHpbZfxIKMc\n\tloRSlY1Us+uV3z3l+oVn86ungkrnzH+uL4TXUdwg=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 24 Mar 2020 12:30:11 +0200", "Message-Id": "<20200324103012.9678-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/2] qcam: viewfinder: Report the natively\n\tsupported pixel 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": "Tue, 24 Mar 2020 10:30:19 -0000" }, "content": "Expose the pixel formats natively supported by the viewfinder, to allow\nselection of stream formats that would minimize usage of software\nconversion.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/viewfinder.cpp | 22 ++++++++++++++--------\n src/qcam/viewfinder.h | 3 +++\n 2 files changed, 17 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\nindex df5ee5ee7b83..0d68f62ee6d7 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder.cpp\n@@ -19,16 +19,16 @@\n \n #include \"format_converter.h\"\n \n-static const QMap<uint32_t, QImage::Format> nativeFormats\n+static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n {\n #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)\n-\t{ DRM_FORMAT_ABGR8888, QImage::Format_RGBA8888 },\n+\t{ libcamera::PixelFormat{ DRM_FORMAT_ABGR8888 }, QImage::Format_RGBA8888 },\n #endif\n-\t{ DRM_FORMAT_ARGB8888, QImage::Format_RGB32 },\n+\t{ libcamera::PixelFormat{ DRM_FORMAT_ARGB8888 }, QImage::Format_RGB32 },\n #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)\n-\t{ DRM_FORMAT_BGR888, QImage::Format_BGR888 },\n+\t{ libcamera::PixelFormat{ DRM_FORMAT_BGR888 }, QImage::Format_BGR888 },\n #endif\n-\t{ DRM_FORMAT_RGB888, QImage::Format_RGB888 },\n+\t{ libcamera::PixelFormat{ DRM_FORMAT_RGB888 }, QImage::Format_RGB888 },\n };\n \n ViewFinder::ViewFinder(QWidget *parent)\n@@ -41,6 +41,12 @@ ViewFinder::~ViewFinder()\n {\n }\n \n+const QList<libcamera::PixelFormat> &ViewFinder::nativeFormats() const\n+{\n+\tstatic const QList<libcamera::PixelFormat> formats = ::nativeFormats.keys();\n+\treturn formats;\n+}\n+\n int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n \t\t\t const QSize &size)\n {\n@@ -50,7 +56,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 (!nativeFormats.contains(format)) {\n+\tif (!::nativeFormats.contains(format)) {\n \t\tint ret = converter_.configure(format, size);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n@@ -83,7 +89,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t{\n \t\tQMutexLocker locker(&mutex_);\n \n-\t\tif (nativeFormats.contains(format_)) {\n+\t\tif (::nativeFormats.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@@ -96,7 +102,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\t\t */\n \t\t\timage_ = QImage(memory, size_.width(), size_.height(),\n \t\t\t\t\tsize / size_.height(),\n-\t\t\t\t\tnativeFormats[format_]);\n+\t\t\t\t\t::nativeFormats[format_]);\n \t\t\tstd::swap(buffer, buffer_);\n \t\t} else {\n \t\t\t/*\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 1a27f99ea202..b3f1d25d9d60 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -10,6 +10,7 @@\n #include <stddef.h>\n \n #include <QIcon>\n+#include <QList>\n #include <QImage>\n #include <QMutex>\n #include <QSize>\n@@ -35,6 +36,8 @@ public:\n \tViewFinder(QWidget *parent);\n \t~ViewFinder();\n \n+\tconst QList<libcamera::PixelFormat> &nativeFormats() const;\n+\n \tint setFormat(const libcamera::PixelFormat &format, const QSize &size);\n \tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map);\n \tvoid stop();\n", "prefixes": [ "libcamera-devel", "1/2" ] }