{"id":16883,"url":"https://patchwork.libcamera.org/api/patches/16883/?format=json","web_url":"https://patchwork.libcamera.org/patch/16883/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220801000543.3501-7-laurent.pinchart@ideasonboard.com>","date":"2022-08-01T00:05:36","name":"[libcamera-devel,06/13] libcamera: v4l2_subdevice: Change V4L2Subdevice::Whence","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"51a989b7f008a795a0c47ab584d1d8951db3e893","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16883/mbox/","series":[{"id":3352,"url":"https://patchwork.libcamera.org/api/series/3352/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3352","date":"2022-08-01T00:05:30","name":"libcamera: pipeline: simple: Support the NXP i.MX8 ISI","version":1,"mbox":"https://patchwork.libcamera.org/series/3352/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16883/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16883/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 82997C3276\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Aug 2022 00:05:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 33E1C63326;\n\tMon,  1 Aug 2022 02:05:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAE3863312\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Aug 2022 02:05:57 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5630230B;\n\tMon,  1 Aug 2022 02:05:57 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659312359;\n\tbh=8nqh/5MSopczm2EoKmlXdolNruINeHQ6JnZdDcm1F2c=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=uMUJcsqyiuwfiK1yVGqQ4/HmmFOxT3rvICoivST+OvWp0hGor0AmOtHJC+vnMD/61\n\tYNaAPhdI9CMG69U9bTkD5teq+2yQfD5fMssZh3JL0buOUSwdgt/OnJko9CdsVmxH5r\n\tIpnFxlajPrqqie36fWglcOf8DNuiKFJJC6myo/vqj5Gavo1uQAYAxjH8HbOfZNBTBV\n\tRI+/tP1I5Qd0za/c9dfVGGaHNfm8QmUIHfjdnpCFNWrrR6HInF244Z6YyEsjCnY9dV\n\truhfvDGCpG5g/D4AjkgxVHL7N099IWq+WfXkROAGWV36zhTD9VVvigBhMCVy9jKNoB\n\tu4mSpWY+EEODg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659312357;\n\tbh=8nqh/5MSopczm2EoKmlXdolNruINeHQ6JnZdDcm1F2c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cYfNQZufdgM1zJnITtVNXfaRoug/R2HFb18Css2HuDXHQMNWYlv/Kd7slINMNzciZ\n\t8N1CwNlALu5chNvmPnyIUuXVKaWkbDLQFqr9pjJUeZhvFxrCKu/3wni6if/tYdH7kr\n\tkbl7w0qzdSzvr4M32lFpkJelt3Ogb12427RyC7RI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"cYfNQZuf\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  1 Aug 2022 03:05:36 +0300","Message-Id":"<20220801000543.3501-7-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>","References":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 06/13] libcamera: v4l2_subdevice: Change\n\tV4L2Subdevice::Whence","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Jacopo Mondi <jacopo@jmondi.org>\n\nThe V4L2Subdevice::Whence enumerations defines two values that should\ncorrespond to the V4L2_SUBDEV_FORMAT_ACTIVE and V4L2_SUBDEV_FORMAT_TRY\ndefinitions.\n\nThe V4L2 symbols are defined as:\n\n\tV4L2_SUBDEV_FORMAT_TRY = 0,\n\tV4L2_SUBDEV_FORMAT_ACTIVE = 1,\n\nWhile the libcamera defined enumeration is:\n\n\tenum Whence {\n\t\tActiveFormat,\n\t\tTryFormat,\n\t}\n\nAs V4L2Subdevice::Whence values are used to populate data types\ndefined in v4l2-subdev.h used as arguments to VIDIOC_SUBDEV_*\nioctls, the V4L2Subdevice class is required to adjust their value as:\n\n       subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n                       : V4L2_SUBDEV_FORMAT_TRY;\n\nDrop the adjustment by defining :\n\n\tWhence::TryFormat = V4L2_SUBDEV_FORMAT_TRY;\n\tWhence::ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE;\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/v4l2_subdevice.h | 6 ++++--\n src/libcamera/v4l2_subdevice.cpp            | 6 ++----\n 2 files changed, 6 insertions(+), 6 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 6fda52ada41b..2db392d5e37a 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -13,6 +13,8 @@\n #include <string>\n #include <vector>\n \n+#include <linux/v4l2-subdev.h>\n+\n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n \n@@ -44,8 +46,8 @@ public:\n \tusing Formats = std::map<unsigned int, std::vector<SizeRange>>;\n \n \tenum Whence {\n-\t\tActiveFormat,\n-\t\tTryFormat,\n+\t\tTryFormat = V4L2_SUBDEV_FORMAT_TRY,\n+\t\tActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,\n \t};\n \n \texplicit V4L2Subdevice(const MediaEntity *entity);\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 98a3911aa7df..37960b76a044 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -416,8 +416,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n \t\t\t     Whence whence)\n {\n \tstruct v4l2_subdev_format subdevFmt = {};\n-\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n-\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n+\tsubdevFmt.which = whence;\n \tsubdevFmt.pad = pad;\n \n \tint ret = ioctl(VIDIOC_SUBDEV_G_FMT, &subdevFmt);\n@@ -452,8 +451,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n \t\t\t     Whence whence)\n {\n \tstruct v4l2_subdev_format subdevFmt = {};\n-\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n-\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n+\tsubdevFmt.which = whence;\n \tsubdevFmt.pad = pad;\n \tsubdevFmt.format.width = format->size.width;\n \tsubdevFmt.format.height = format->size.height;\n","prefixes":["libcamera-devel","06/13"]}