Show a patch.

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

{
    "id": 16891,
    "url": "https://patchwork.libcamera.org/api/patches/16891/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16891/",
    "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": "<20220801082420.68120-1-umang.jain@ideasonboard.com>",
    "date": "2022-08-01T08:24:20",
    "name": "[libcamera-devel,v2] libcamera: v4l2: Set colorspace flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "aa6005fb9143eb3d2a87517b4e18a6d4df2aa826",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/16891/mbox/",
    "series": [
        {
            "id": 3353,
            "url": "https://patchwork.libcamera.org/api/series/3353/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3353",
            "date": "2022-08-01T08:24:20",
            "name": "[libcamera-devel,v2] libcamera: v4l2: Set colorspace flags",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3353/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16891/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16891/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 BD77AC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Aug 2022 08:24:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2FD656330F;\n\tMon,  1 Aug 2022 10:24:44 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84A0C603E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Aug 2022 10:24:42 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3e:f7a:bc8f:12ed:b45f:c35d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 805982F3;\n\tMon,  1 Aug 2022 10:24:40 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659342284;\n\tbh=8iNiWHVBZjzxPyE9kBPIcljXt+h4Fchu+VI/C3vW3Xs=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=VTDypzHJkcm8t2r1qOVp/hzqrlmADkUIJNF0K1oGCLJ2DDyxztGPIIcU8rwhU16yW\n\tRNbDvWWmTlSOhPRrTWzku2ida1uKRDgTpEGPCfn2CirvhiRAoSpCrf0QRX5+UZq8mz\n\tJ56Djw6hyhwa0rQF8rjsAev/orEVb5TufSpjO0LBqfjoVLVWfmGPIYbnI26vhXrRF+\n\t4MY4MH2GSlW/OFvC7baJGjcWEr3kHNhAyQwW7gMMaYE++tJF11c0alJ/MWpaTC0mXj\n\tlrVWY+X2lWFMPJaxit0GckG39yPYhKkX6Owr9srzgkmX+LPPlOYAe5Fisz3BiqJJjS\n\tDEIBmS/St3Qvw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659342282;\n\tbh=8iNiWHVBZjzxPyE9kBPIcljXt+h4Fchu+VI/C3vW3Xs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=QEWlVhQVZMteipiyZcgkVGyzY4m021eRQaKL0S3vbD4tv7Zk5uZ+R4P4krF+bmcb3\n\tBfEYd4Ex9d0ytjm6d4zBvnMfuwqFlD01zXM7QSsadeJxbuuNkezP6YzAWOjhx33y17\n\t+uTokyTX5v1Q3jovWDwbPEWBY/jq5JYupe0RTcEc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QEWlVhQV\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  1 Aug 2022 13:54:20 +0530",
        "Message-Id": "<20220801082420.68120-1-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: v4l2: Set colorspace flags",
        "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>",
        "From": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>",
        "Cc": "rishikeshdonadkar@gmail.com",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The colorspace fields are read-only from an application point of view,\nboth on video devices and on subdevs, unless the\nV4L2_PIX_FMT_FLAG_SET_CSC or V4L2_MBUS_FRAMEFMT_SET_CSC flags\n(respectively) are set when calling the S_FMT ioctl.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\nchanges in v2:\n- Set V4L2_MBUS_FRAMEFMT_SET_CSC flag only on source pad of\n  media entity\n- Set V4L2_PIX_FMT_FLAG_SET_CSC on video capture devices only\n---\n src/libcamera/v4l2_subdevice.cpp   | 6 ++++--\n src/libcamera/v4l2_videodevice.cpp | 8 ++++++--\n 2 files changed, 10 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 98a3911a..8f6b327f 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -459,9 +459,11 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n \tsubdevFmt.format.height = format->size.height;\n \tsubdevFmt.format.code = format->mbus_code;\n \tsubdevFmt.format.field = V4L2_FIELD_NONE;\n-\tfromColorSpace(format->colorSpace, subdevFmt.format);\n+\tint ret = fromColorSpace(format->colorSpace, subdevFmt.format);\n+\tif (ret == 0 && (entity_->pads()[pad]->flags() & MEDIA_PAD_FL_SOURCE))\n+\t\tsubdevFmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;\n \n-\tint ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt);\n+\tret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt);\n \tif (ret) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Unable to set format on pad \" << pad\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 63911339..f3651740 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -940,7 +940,9 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n \tpix->pixelformat = format->fourcc;\n \tpix->num_planes = format->planesCount;\n \tpix->field = V4L2_FIELD_NONE;\n-\tfromColorSpace(format->colorSpace, *pix);\n+\tret = fromColorSpace(format->colorSpace, *pix);\n+\tif (ret == 0 && caps_.isVideoCapture())\n+\t\tpix->flags |= V4L2_PIX_FMT_FLAG_SET_CSC;\n \n \tASSERT(pix->num_planes <= std::size(pix->plane_fmt));\n \n@@ -1010,7 +1012,9 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n \tpix->pixelformat = format->fourcc;\n \tpix->bytesperline = format->planes[0].bpl;\n \tpix->field = V4L2_FIELD_NONE;\n-\tfromColorSpace(format->colorSpace, *pix);\n+\tret = fromColorSpace(format->colorSpace, *pix);\n+\tif (ret == 0 && caps_.isVideoCapture())\n+\t\tpix->flags |= V4L2_PIX_FMT_FLAG_SET_CSC;\n \n \tret = ioctl(set ? VIDIOC_S_FMT : VIDIOC_TRY_FMT, &v4l2Format);\n \tif (ret) {\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}