Show a patch.

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

{
    "id": 2915,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2915/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2915/",
    "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": "<20200228032913.497826-6-niklas.soderlund@ragnatech.se>",
    "date": "2020-02-28T03:29:12",
    "name": "[libcamera-devel,RFC,5/6] libcamera: v4l2_videodevice: Remove pixel format translators",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "42485eab0c3aa1e04b1c9254126f2a489f77d181",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2915/mbox/",
    "series": [
        {
            "id": 694,
            "url": "https://patchwork.libcamera.org/api/1.1/series/694/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=694",
            "date": "2020-02-28T03:29:07",
            "name": "libcamera: PixelFormat: Turn into a class",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/694/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2915/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2915/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C475A6271F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Feb 2020 04:29:40 +0100 (CET)",
            "from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de\n\t[79.202.35.146]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 8d4fcf04-59da-11ea-9f85-005056917a89;\n\tFri, 28 Feb 2020 04:29:39 +0100 (CET)"
        ],
        "X-Halon-ID": "8d4fcf04-59da-11ea-9f85-005056917a89",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 28 Feb 2020 04:29:12 +0100",
        "Message-Id": "<20200228032913.497826-6-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200228032913.497826-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200228032913.497826-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC 5/6] libcamera: v4l2_videodevice: Remove\n\tpixel format translators",
        "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": "Fri, 28 Feb 2020 03:29:41 -0000"
    },
    "content": "Switch to use PixelFormat to translate between DRM and V4L2 instead of\nhaving a proxy implementation inside V4L2VideoDevice.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/v4l2_videodevice.h |  4 ---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp |  4 +--\n src/libcamera/pipeline/uvcvideo.cpp      |  4 +--\n src/libcamera/pipeline/vimc.cpp          |  4 +--\n src/libcamera/v4l2_videodevice.cpp       | 44 ------------------------\n test/camera/buffer_import.cpp            |  2 +-\n 6 files changed, 7 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 982df9d2f918e49c..9666a4dd2438a5ee 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -199,10 +199,6 @@ public:\n \tstatic V4L2VideoDevice *fromEntityName(const MediaDevice *media,\n \t\t\t\t\t       const std::string &entity);\n \n-\tstatic PixelFormat toPixelFormat(uint32_t v4l2Fourcc);\n-\tuint32_t toV4L2Fourcc(PixelFormat pixelFormat);\n-\tstatic uint32_t toV4L2Fourcc(PixelFormat pixelFormat, bool multiplanar);\n-\n protected:\n \tstd::string logPrefix() const;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 323fa3596c6ee242..f1ffb7acded5f4ee 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -629,7 +629,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tLOG(RkISP1, Debug) << \"Resizer output pad configured with \" << format.toString();\n \n \tV4L2DeviceFormat outputFormat = {};\n-\toutputFormat.fourcc = video_->toV4L2Fourcc(cfg.pixelFormat);\n+\toutputFormat.fourcc = cfg.pixelFormat.v4l2();\n \toutputFormat.size = cfg.size;\n \toutputFormat.planesCount = 2;\n \n@@ -638,7 +638,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \t\treturn ret;\n \n \tif (outputFormat.size != cfg.size ||\n-\t    outputFormat.fourcc != video_->toV4L2Fourcc(cfg.pixelFormat)) {\n+\t    outputFormat.fourcc != cfg.pixelFormat.v4l2()) {\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Unable to configure capture in \" << cfg.toString();\n \t\treturn -EINVAL;\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 75fbfe1eb9145424..89c47b99df22395b 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -177,7 +177,7 @@ int PipelineHandlerUVC::configure(Camera *camera, CameraConfiguration *config)\n \tint ret;\n \n \tV4L2DeviceFormat format = {};\n-\tformat.fourcc = data->video_->toV4L2Fourcc(cfg.pixelFormat);\n+\tformat.fourcc = cfg.pixelFormat.v4l2();\n \tformat.size = cfg.size;\n \n \tret = data->video_->setFormat(&format);\n@@ -185,7 +185,7 @@ int PipelineHandlerUVC::configure(Camera *camera, CameraConfiguration *config)\n \t\treturn ret;\n \n \tif (format.size != cfg.size ||\n-\t    format.fourcc != data->video_->toV4L2Fourcc(cfg.pixelFormat))\n+\t    format.fourcc != cfg.pixelFormat.v4l2())\n \t\treturn -EINVAL;\n \n \tcfg.setStream(&data->stream_);\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex a591c424919b0783..f9e24f288d732f74 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -232,7 +232,7 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config)\n \t\treturn ret;\n \n \tV4L2DeviceFormat format = {};\n-\tformat.fourcc = data->video_->toV4L2Fourcc(cfg.pixelFormat);\n+\tformat.fourcc = cfg.pixelFormat.v4l2();\n \tformat.size = cfg.size;\n \n \tret = data->video_->setFormat(&format);\n@@ -240,7 +240,7 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config)\n \t\treturn ret;\n \n \tif (format.size != cfg.size ||\n-\t    format.fourcc != data->video_->toV4L2Fourcc(cfg.pixelFormat))\n+\t    format.fourcc != cfg.pixelFormat.v4l2())\n \t\treturn -EINVAL;\n \n \t/*\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex e9d3e60198e140a0..d3d5f73193e3abef 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1410,50 +1410,6 @@ V4L2VideoDevice *V4L2VideoDevice::fromEntityName(const MediaDevice *media,\n \treturn new V4L2VideoDevice(mediaEntity);\n }\n \n-/**\n- * \\brief Convert a \\a v4l2Fourcc to the corresponding PixelFormat\n- * \\param[in] v4l2Fourcc The V4L2 pixel format (V4L2_PIX_FORMAT_*)\n- * \\return The PixelFormat corresponding to \\a v4l2Fourcc\n- */\n-PixelFormat V4L2VideoDevice::toPixelFormat(uint32_t v4l2Fourcc)\n-{\n-\treturn PixelFormat(v4l2Fourcc);\n-}\n-\n-/**\n- * \\brief Convert \\a PixelFormat to its corresponding V4L2 FourCC\n- * \\param[in] pixelFormat The PixelFormat to convert\n- *\n- * For multiplanar formats, the V4L2 format variant (contiguous or\n- * non-contiguous planes) is selected automatically based on the capabilities\n- * of the video device. If the video device supports the V4L2 multiplanar API,\n- * non-contiguous formats are preferred.\n- *\n- * \\return The V4L2_PIX_FMT_* pixel format code corresponding to \\a pixelFormat\n- */\n-uint32_t V4L2VideoDevice::toV4L2Fourcc(PixelFormat pixelFormat)\n-{\n-\treturn V4L2VideoDevice::toV4L2Fourcc(pixelFormat, caps_.isMultiplanar());\n-}\n-\n-/**\n- * \\brief Convert \\a pixelFormat to its corresponding V4L2 FourCC\n- * \\param[in] pixelFormat The PixelFormat to convert\n- * \\param[in] multiplanar V4L2 Multiplanar API support flag\n- *\n- * Multiple V4L2 formats may exist for one PixelFormat when the format uses\n- * multiple planes, as V4L2 defines separate 4CCs for contiguous and separate\n- * planes formats. Set the \\a multiplanar parameter to false to select a format\n- * with contiguous planes, or to true to select a format with non-contiguous\n- * planes.\n- *\n- * \\return The V4L2_PIX_FMT_* pixel format code corresponding to \\a pixelFormat\n- */\n-uint32_t V4L2VideoDevice::toV4L2Fourcc(PixelFormat pixelFormat, bool multiplanar)\n-{\n-\treturn pixelFormat.v4l2();\n-}\n-\n /**\n  * \\class V4L2M2MDevice\n  * \\brief Memory-to-Memory video device\ndiff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp\nindex ab6e74bd1671e6f5..d47a9d8516c58375 100644\n--- a/test/camera/buffer_import.cpp\n+++ b/test/camera/buffer_import.cpp\n@@ -89,7 +89,7 @@ public:\n \t\t}\n \n \t\tformat.size = config.size;\n-\t\tformat.fourcc = V4L2VideoDevice::toV4L2Fourcc(config.pixelFormat, false);\n+\t\tformat.fourcc = config.pixelFormat.v4l2();\n \t\tif (video_->setFormat(&format)) {\n \t\t\tstd::cout << \"Failed to set format on output device\" << std::endl;\n \t\t\treturn TestFail;\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "5/6"
    ]
}