From patchwork Thu Jun 13 11:20:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 1424 Return-Path: Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 971FD61BD1 for ; Thu, 13 Jun 2019 13:19:41 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 24A68C000C; Thu, 13 Jun 2019 11:19:40 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 13 Jun 2019 13:20:40 +0200 Message-Id: <20190613112046.25260-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/6] Add support for V4L2 Controls X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2019 11:19:41 -0000 Hello, new V4L2 controls support iteration. The patches are based on the in-review: [PATCH v4 0/2] libcamera: Introduce V4L2Device base class This new version changes quite a few things, and is the result of the combined review effort from everyone! Thanks a lot. Most notable changes: - Drop the support for compound and string controls - As a consequence drop template control values: everything is now stored in a long int - Decouple the control value from its information as Kieran has done for the libcamera control - Cache all controls info at V4L2 device open time to avoid extra calls to VIDIOC_QUERY_EXT_CTRL - Support creation on controls without value to be provided to getControls - Change V4L2Device::getControls() to accept a V4L2Controls as setControls() does. The new interface is demonstrated by the last patch, and I report it here a snippet: /* --- Get control values --- */ V4L2Controls controls; controls.add(V4L2_CID_EXPOSURE); controls.add(V4L2_CID_ANALOGUE_GAIN); cio2->sensor_->getControls(&controls); for (const V4L2Control &ctrl : controls) { unsigned int id = ctrl.id(); V4L2ControlInfo *info = cio2->sensor_->getControlInfo(id); if (!info) continue; int val = controls.get(id); LOG(Error) << "Control : " << id << " - name : " << info->name() << " - value: " << val; } /* --- Set control values --- */ controls.set(V4L2_CID_EXPOSURE, 2046); controls.set(V4L2_CID_ANALOGUE_GAIN, 1024); cio2->sensor_->setControls(&controls); /* --- Get control values back again and verify they have changed --- */ cio2->sensor_->getControls(&controls); for (const V4L2Control &ctrl : controls) { unsigned int id = ctrl.id(); V4L2ControlInfo *info = cio2->sensor_->getControlInfo(id); if (!info) continue; int val = controls.get(id); LOG(Error) << "Control : " << id << " - name : " << info->name() << " - value: " << val; } Thanks j Jacopo Mondi (6): libcamera: Add V4L2Controls libcamera: v4l2_device: List controls at device open libcamera: v4l2_device: Implement get and set controls libcamera: camera_sensor: Add V4L2 control operations libcamera: ipu3: Set pipe_mode based on stream configuration [HACK] ipu3: Set and get a few sensor controls src/libcamera/camera_sensor.cpp | 58 +++++ src/libcamera/include/camera_sensor.h | 6 + src/libcamera/include/v4l2_controls.h | 96 ++++++++ src/libcamera/include/v4l2_device.h | 14 +- src/libcamera/meson.build | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 78 ++++++ src/libcamera/v4l2_controls.cpp | 337 ++++++++++++++++++++++++++ src/libcamera/v4l2_device.cpp | 219 +++++++++++++++++ 8 files changed, 808 insertions(+), 1 deletion(-) create mode 100644 src/libcamera/include/v4l2_controls.h create mode 100644 src/libcamera/v4l2_controls.cpp --- 2.21.0