Show a patch.

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

{
    "id": 4011,
    "url": "https://patchwork.libcamera.org/api/patches/4011/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4011/",
    "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": "<20200609232323.29628-7-laurent.pinchart@ideasonboard.com>",
    "date": "2020-06-09T23:23:22",
    "name": "[libcamera-devel,v2,6/7] libcamera: pipeline: Replace explicit DRM FourCCs with libcamera formats",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bfbda1a2015f99a7a2ad2603774d54d86596624c",
    "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/4011/mbox/",
    "series": [
        {
            "id": 982,
            "url": "https://patchwork.libcamera.org/api/series/982/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=982",
            "date": "2020-06-09T23:23:16",
            "name": "Introduce formats:: namespace for libcamera pixel formats",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/982/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4011/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4011/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 2BF4D63D09\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:51 +0200 (CEST)",
            "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 BCC9B291\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:50 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Vm7oMGMJ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591745030;\n\tbh=J+jxymhaanzNydDimQV+ghf/tvEP1VUWl1ii6noT3zw=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Vm7oMGMJ+xCFZHd9CtCn591yyIueUILM2HVwesIzs2hOuRTVPwBrMtoZ2pCbeg7Li\n\t+BPN8vd9h4zd20FDgLXGhk7H8dZoptiBzzFZIN8OXblKPOl0Sz9oZ8h0uvmvQLk2gI\n\tDs4hI6RFRoi1IwdNgnqjulDXmJbTX5eQDcYphDdE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 10 Jun 2020 02:23:22 +0300",
        "Message-Id": "<20200609232323.29628-7-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 6/7] libcamera: pipeline: Replace\n\texplicit DRM FourCCs with libcamera 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, 09 Jun 2020 23:23:52 -0000"
    },
    "content": "Use the new pixel format constants to replace usage of macros from\ndrm_fourcc.h.\n\nThe IPU3 pipeline handler still uses DRM FourCCs for IPU3-specific\nformats that are not defined in the libcamera public API.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Use formats::S[RGB]{4}_IPU3 in the IPU3 pipeline handler\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp          | 16 +++++++++-------\n .../pipeline/raspberrypi/raspberrypi.cpp      | 10 +++++-----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 19 ++++++++++---------\n src/libcamera/pipeline/vimc/vimc.cpp          | 11 ++++++-----\n 4 files changed, 30 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex b805fea71c2d..adbe4f7e0a79 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -11,9 +11,11 @@\n #include <queue>\n #include <vector>\n \n+#include <linux/drm_fourcc.h>\n #include <linux/media-bus-format.h>\n \n #include <libcamera/camera.h>\n+#include <libcamera/formats.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -34,10 +36,10 @@ LOG_DEFINE_CATEGORY(IPU3)\n class IPU3CameraData;\n \n static const std::map<uint32_t, PixelFormat> sensorMbusToPixel = {\n-\t{ MEDIA_BUS_FMT_SBGGR10_1X10, PixelFormat(DRM_FORMAT_SBGGR10, IPU3_FORMAT_MOD_PACKED) },\n-\t{ MEDIA_BUS_FMT_SGBRG10_1X10, PixelFormat(DRM_FORMAT_SGBRG10, IPU3_FORMAT_MOD_PACKED) },\n-\t{ MEDIA_BUS_FMT_SGRBG10_1X10, PixelFormat(DRM_FORMAT_SGRBG10, IPU3_FORMAT_MOD_PACKED) },\n-\t{ MEDIA_BUS_FMT_SRGGB10_1X10, PixelFormat(DRM_FORMAT_SRGGB10, IPU3_FORMAT_MOD_PACKED) },\n+\t{ MEDIA_BUS_FMT_SBGGR10_1X10, formats::SBGGR10_IPU3 },\n+\t{ MEDIA_BUS_FMT_SGBRG10_1X10, formats::SGBRG10_IPU3 },\n+\t{ MEDIA_BUS_FMT_SGRBG10_1X10, formats::SGRBG10_IPU3 },\n+\t{ MEDIA_BUS_FMT_SRGGB10_1X10, formats::SRGGB10_IPU3 },\n };\n \n class ImgUDevice\n@@ -261,7 +263,7 @@ IPU3CameraConfiguration::IPU3CameraConfiguration(Camera *camera,\n void IPU3CameraConfiguration::adjustStream(StreamConfiguration &cfg, bool scale)\n {\n \t/* The only pixel format the driver supports is NV12. */\n-\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n+\tcfg.pixelFormat = formats::NV12;\n \n \tif (scale) {\n \t\t/*\n@@ -430,7 +432,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\tStreamConfiguration cfg = {};\n \t\tIPU3Stream *stream = nullptr;\n \n-\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n+\t\tcfg.pixelFormat = formats::NV12;\n \n \t\tswitch (role) {\n \t\tcase StreamRole::StillCapture:\n@@ -1193,7 +1195,7 @@ int ImgUDevice::configureOutput(ImgUOutput *output,\n \t\treturn 0;\n \n \t*outputFormat = {};\n-\toutputFormat->fourcc = dev->toV4L2PixelFormat(PixelFormat(DRM_FORMAT_NV12));\n+\toutputFormat->fourcc = dev->toV4L2PixelFormat(formats::NV12);\n \toutputFormat->size = cfg.size;\n \toutputFormat->planesCount = 2;\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 7f23666ea8f4..60985b716833 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -13,12 +13,12 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n+#include <libcamera/formats.h>\n #include <libcamera/ipa/raspberrypi.h>\n #include <libcamera/logging.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n-#include <linux/drm_fourcc.h>\n #include <linux/videodev2.h>\n \n #include \"libcamera/internal/camera_sensor.h\"\n@@ -490,7 +490,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \n \t\tif (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) {\n \t\t\t/* If we cannot find a native format, use a default one. */\n-\t\t\tcfgPixFmt = PixelFormat(DRM_FORMAT_NV12);\n+\t\t\tcfgPixFmt = formats::NV12;\n \t\t\tstatus = Adjusted;\n \t\t}\n \t}\n@@ -537,20 +537,20 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t\tbreak;\n \n \t\tcase StreamRole::StillCapture:\n-\t\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n+\t\t\tcfg.pixelFormat = formats::NV12;\n \t\t\t/* Return the largest sensor resolution. */\n \t\t\tcfg.size = data->sensor_->resolution();\n \t\t\tcfg.bufferCount = 1;\n \t\t\tbreak;\n \n \t\tcase StreamRole::VideoRecording:\n-\t\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n+\t\t\tcfg.pixelFormat = formats::NV12;\n \t\t\tcfg.size = { 1920, 1080 };\n \t\t\tcfg.bufferCount = 4;\n \t\t\tbreak;\n \n \t\tcase StreamRole::Viewfinder:\n-\t\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_ARGB8888);\n+\t\t\tcfg.pixelFormat = formats::ARGB8888;\n \t\t\tcfg.size = { 800, 600 };\n \t\t\tcfg.bufferCount = 4;\n \t\t\tbreak;\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 900f873ab028..e439f3149bce 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -16,6 +16,7 @@\n #include <libcamera/buffer.h>\n #include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n+#include <libcamera/formats.h>\n #include <libcamera/ipa/rkisp1.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n@@ -459,13 +460,13 @@ RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\n CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n {\n \tstatic const std::array<PixelFormat, 8> formats{\n-\t\tPixelFormat(DRM_FORMAT_YUYV),\n-\t\tPixelFormat(DRM_FORMAT_YVYU),\n-\t\tPixelFormat(DRM_FORMAT_VYUY),\n-\t\tPixelFormat(DRM_FORMAT_NV16),\n-\t\tPixelFormat(DRM_FORMAT_NV61),\n-\t\tPixelFormat(DRM_FORMAT_NV21),\n-\t\tPixelFormat(DRM_FORMAT_NV12),\n+\t\tformats::YUYV,\n+\t\tformats::YVYU,\n+\t\tformats::VYUY,\n+\t\tformats::NV16,\n+\t\tformats::NV61,\n+\t\tformats::NV21,\n+\t\tformats::NV12,\n \t\t/* \\todo Add support for 8-bit greyscale to DRM formats */\n \t};\n \n@@ -487,7 +488,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \tif (std::find(formats.begin(), formats.end(), cfg.pixelFormat) ==\n \t    formats.end()) {\n \t\tLOG(RkISP1, Debug) << \"Adjusting format to NV12\";\n-\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12),\n+\t\tcfg.pixelFormat = formats::NV12,\n \t\tstatus = Adjusted;\n \t}\n \n@@ -566,7 +567,7 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera\n \t\treturn config;\n \n \tStreamConfiguration cfg{};\n-\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n+\tcfg.pixelFormat = formats::NV12;\n \tcfg.size = data->sensor_->resolution();\n \n \tconfig->addConfiguration(cfg);\ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex 3881545b8a53..b6530662a9ba 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -17,6 +17,7 @@\n #include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n+#include <libcamera/formats.h>\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n #include <libcamera/request.h>\n@@ -108,8 +109,8 @@ private:\n namespace {\n \n static const std::map<PixelFormat, uint32_t> pixelformats{\n-\t{ PixelFormat(DRM_FORMAT_RGB888), MEDIA_BUS_FMT_BGR888_1X24 },\n-\t{ PixelFormat(DRM_FORMAT_BGR888), MEDIA_BUS_FMT_RGB888_1X24 },\n+\t{ formats::RGB888, MEDIA_BUS_FMT_BGR888_1X24 },\n+\t{ formats::BGR888, MEDIA_BUS_FMT_RGB888_1X24 },\n };\n \n } /* namespace */\n@@ -138,7 +139,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()\n \tconst std::vector<libcamera::PixelFormat> formats = cfg.formats().pixelformats();\n \tif (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {\n \t\tLOG(VIMC, Debug) << \"Adjusting format to BGR888\";\n-\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888);\n+\t\tcfg.pixelFormat = formats::BGR888;\n \t\tstatus = Adjusted;\n \t}\n \n@@ -184,7 +185,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,\n \t\t * but it isn't functional within the pipeline.\n \t\t */\n \t\tif (data->media_->version() < KERNEL_VERSION(5, 7, 0)) {\n-\t\t\tif (pixelformat.first != PixelFormat(DRM_FORMAT_BGR888)) {\n+\t\t\tif (pixelformat.first != formats::BGR888) {\n \t\t\t\tLOG(VIMC, Info)\n \t\t\t\t\t<< \"Skipping unsupported pixel format \"\n \t\t\t\t\t<< pixelformat.first.toString();\n@@ -201,7 +202,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,\n \n \tStreamConfiguration cfg(formats);\n \n-\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888);\n+\tcfg.pixelFormat = formats::BGR888;\n \tcfg.size = { 1920, 1080 };\n \tcfg.bufferCount = 4;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "6/7"
    ]
}