Patch Detail
Show a patch.
GET /api/patches/17084/?format=api
{ "id": 17084, "url": "https://patchwork.libcamera.org/api/patches/17084/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17084/", "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": "<20220812085324.266351-1-umang.jain@ideasonboard.com>", "date": "2022-08-12T08:53:24", "name": "[libcamera-devel,v3] libcamera: v4l2: Set colorspace flags", "commit_ref": "f094c2922ad5708c876796f0ae5e7732b51e9c66", "pull_url": null, "state": "accepted", "archived": false, "hash": "64a3f0cc6e9aebf841cbdbb09afe1ac62c43f130", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17084/mbox/", "series": [ { "id": 3406, "url": "https://patchwork.libcamera.org/api/series/3406/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3406", "date": "2022-08-12T08:53:24", "name": "[libcamera-devel,v3] libcamera: v4l2: Set colorspace flags", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3406/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17084/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17084/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 01C73C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Aug 2022 08:53:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F294E6332A;\n\tFri, 12 Aug 2022 10:53:34 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E234963326\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Aug 2022 10:53:33 +0200 (CEST)", "from perceval.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3f:c7a1:27b3:9637:38a7:6084])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 46B1230A;\n\tFri, 12 Aug 2022 10:53:31 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660294415;\n\tbh=b0qE+sR0tkhDdVwah/boffbNsT/kd/Rz5OKOYWRo1XU=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=knEky9U4xpsi3EzyjZtf7RcEM+dQ9nMzH+9tG9FrvymOJl1W5SLclst/N0a3oQT73\n\tiRopL1CucM9Wg7CAzbl66BMz8lDF/DnqCg04QcvltTwYlegpYxeapITcwff2lbJXg9\n\tx135JKizmCvlGV2UkqxXB6JFlPDANObmCLhlxR8duimZPg2bSor35NyUN/RWzg+xuU\n\tP/CMKBHlJM+9T1MbkoHCB/8Jblzma+HJnyfG4IKmr5yQn0sxC36PGKt8D/5Nq0mWOz\n\tM681FI/pE8m4Vi0XpduO/0s8RhsE6pRpjmrZJUTdn8+r7KVhGhBG3ld2tiwM+fBCVV\n\tVex6mXKMoDzbQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660294413;\n\tbh=b0qE+sR0tkhDdVwah/boffbNsT/kd/Rz5OKOYWRo1XU=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=WCb+19IBBb0NlXFLEdJNJHhtqMxOJCvNpc2HXqeTy6fyQZiGcBrz/+pBArW+P819u\n\tYjYYQFzCZ/haFvsmFmL6dPfUpNyBSN0FvPcWiTWFB9wQY0iOTmlw/xAzZnlc2Fv1ov\n\tyu/+NH/DQ4FMo6rUVVYTeo/xHBz7/PcG8ogQf2BQ=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WCb+19IB\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 12 Aug 2022 14:23:24 +0530", "Message-Id": "<20220812085324.266351-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 v3] 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>", "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---\n src/libcamera/v4l2_subdevice.cpp | 8 +++++++-\n src/libcamera/v4l2_videodevice.cpp | 14 ++++++++++++--\n 2 files changed, 19 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex e5d20f2c..d8fd92e3 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -526,7 +526,13 @@ 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+\tif (format->colorSpace) {\n+\t\tfromColorSpace(format->colorSpace, subdevFmt.format);\n+\n+\t\t/* The CSC flag is only applicable to source pads. */\n+\t\tif (entity_->pads()[pad]->flags() & MEDIA_PAD_FL_SOURCE)\n+\t\t\tsubdevFmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;\n+\t}\n \n \tint ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt);\n \tif (ret) {\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex b80ee1cd..5a2d0e5b 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -953,7 +953,12 @@ 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+\tif (format->colorSpace) {\n+\t\tfromColorSpace(format->colorSpace, *pix);\n+\n+\t\tif (caps_.isVideoCapture())\n+\t\t\tpix->flags |= V4L2_PIX_FMT_FLAG_SET_CSC;\n+\t}\n \n \tASSERT(pix->num_planes <= std::size(pix->plane_fmt));\n \n@@ -1023,7 +1028,12 @@ 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+\tif (format->colorSpace) {\n+\t\tfromColorSpace(format->colorSpace, *pix);\n+\n+\t\tif (caps_.isVideoCapture())\n+\t\t\tpix->flags |= V4L2_PIX_FMT_FLAG_SET_CSC;\n+\t}\n \n \tret = ioctl(set ? VIDIOC_S_FMT : VIDIOC_TRY_FMT, &v4l2Format);\n \tif (ret) {\n", "prefixes": [ "libcamera-devel", "v3" ] }