From patchwork Thu Jun 6 20:56:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 1372 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E1DD60BB7 for ; Thu, 6 Jun 2019 22:56:58 +0200 (CEST) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A92033B; Thu, 6 Jun 2019 22:56:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1559854617; bh=g7FaXyDk4re0VBUHnEYhMEkQfb6hcIdedMWtzMPlpAY=; h=From:To:Cc:Subject:Date:From; b=A8vrRD1LE9Ju5Cpaf6sknpHqmRBqp5R4MNYnL18knPEcmK7L3COM3bWTogXbN8+Yw L+7FydLfzBrdzIMH8ZkYmk+HiNhx+HvgX0P9yHZXdxRuQTgLi3P8yiV4fvfN2NPCUB zoHfXHXMLeKK65P5Xo50UeCExDjW+pdX1SKoQL64= From: Kieran Bingham To: LibCamera Devel Date: Thu, 6 Jun 2019 21:56:49 +0100 Message-Id: <20190606205654.9311-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 0/5] Libcamera 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, 06 Jun 2019 20:56:58 -0000 I've been sketching out these controls for a bit, and I wanted to get them on the list as a refernce point for some furthur discussions. The patches are based on top of a combination of both Jacopo's V4L2 Control series, and Niklas' enum series. I am still undecided as to whether the best route forwards is to keep the controls as a std::set with the Control class handling the ID and type checking, or if a std::map might be more flexible. With a control class, I can make sure the construction logic is contained, but I lose the ease of 'mapping' an ID to the control value within the std::set. I've implemented a comparator, which allows the use of .find(), but I'm not sure I'm fond of that yet, especially in the pain points of handling searching for an ID which isn't in the set. I'd love to be able to make a set operate more like a map using the internal key, or perhaps make a map look more like a set, so that the ID and Value are more closely associated. I have also considered that I could update Jacopo's V4L2 controls to utilise the ControlValue type, which would then allow for any controls which want to map directly to a V4L2 control - the ControlValue itself could be passed to the V4L2 layer and populated there. However this would only then push the requirement to 'find' the appropriate ControlValue object down to the V4L2 layer. Anyway, there's a lovely demo at the end which shows setting the Brightness control from the qcam application as a sine wave which makes for a visual clarification that the controls are successfully being set. As noted there, We will likely want to extend controls such that a particular control knows about it's max/min/default values. And that then (to me) provides another argument to use the class Control with a set over a map. Anyway, any thoughts on a postcard sized reply. Please don't focus on typos' or grammar, as this is an RFC about the usage and API more than the patches themselves. Kieran Bingham (5): libcamera: Add control handling libcamera: request: add a control set libcamera: pipeline: Add readControls(), writeControl() interfaces QCam: Set a read control on each request to get Gain value [PoC] QCam: Control demo: A SineWave Brightness include/libcamera/controls.h | 106 ++++++++ include/libcamera/meson.build | 1 + include/libcamera/request.h | 4 + src/libcamera/controls.cpp | 310 +++++++++++++++++++++++ src/libcamera/include/pipeline_handler.h | 3 + src/libcamera/meson.build | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 19 ++ src/libcamera/pipeline/raspberrypi.cpp | 108 +++++++- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 19 ++ src/libcamera/pipeline/uvcvideo.cpp | 127 +++++++++- src/libcamera/pipeline/vimc.cpp | 19 ++ src/qcam/main_window.cpp | 24 ++ 12 files changed, 739 insertions(+), 2 deletions(-) create mode 100644 include/libcamera/controls.h create mode 100644 src/libcamera/controls.cpp