[{"id":1785,"web_url":"https://patchwork.libcamera.org/comment/1785/","msgid":"<20190607155155.GQ7593@pendragon.ideasonboard.com>","date":"2019-06-07T15:51:55","subject":"Re: [libcamera-devel] [RFC PATCH 0/5] Libcamera Controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Jun 06, 2019 at 09:56:49PM +0100, Kieran Bingham wrote:\n> I've been sketching out these controls for a bit, and I wanted to get them on\n> the list as a refernce point for some furthur discussions.\n> \n> The patches are based on top of a combination of both Jacopo's V4L2 Control\n> series, and Niklas' enum series.\n> \n> I am still undecided as to whether the best route forwards is to keep the\n> controls as a std::set <Control> with the Control class handling the ID and\n> type checking, or if a std::map<ControlID, ControlValue> might be more\n> flexible.\n> \n> With a control class, I can make sure the construction logic is contained, but\n> I lose the ease of 'mapping' an ID to the control value within the std::set.\n> I've implemented a comparator, which allows the use of .find(), but I'm not\n> sure I'm fond of that yet, especially in the pain points of handling searching\n> for an ID which isn't in the set.\n> \n> I'd love to be able to make a set operate more like a map using the internal\n> key, or perhaps make a map look more like a set, so that the ID and Value are\n> more closely associated.\n\nCouldn't you use an std::unordered_set with custom comparison and hash\nfunctions that only take the ID into account ?\n\n> I have also considered that I could update Jacopo's V4L2 controls to utilise\n> the ControlValue type, which would then allow for any controls which want to\n> map directly to a V4L2 control - the ControlValue itself could be passed to the\n> V4L2 layer and populated there. However this would only then push the\n> requirement to 'find' the appropriate ControlValue object down to the V4L2\n> layer.\n\nI haven't read the patches from this series yet, but sharing a control\nvalue class could possibly make sense.\n\n> Anyway, there's a lovely demo at the end which shows setting the Brightness\n> control from the qcam application as a sine wave which makes for a visual\n> clarification that the controls are successfully being set.\n> \n> As noted there, We will likely want to extend controls such that a particular\n> control knows about it's max/min/default values. And that then (to me) provides\n> another argument to use the class Control with a set over a map.\n\nWe may want to separate the control value, which will be set per\nrequest, from the control information that will be global.\n\n> Anyway, any thoughts on a postcard sized reply. Please don't focus on typos' or\n> grammar, as this is an RFC about the usage and API more than the patches\n> themselves.\n> \n> \n> Kieran Bingham (5):\n>   libcamera: Add control handling\n>   libcamera: request: add a control set\n>   libcamera: pipeline: Add readControls(), writeControl() interfaces\n>   QCam: Set a read control on each request to get Gain value\n>   [PoC] QCam: Control demo: A SineWave Brightness\n> \n>  include/libcamera/controls.h             | 106 ++++++++\n>  include/libcamera/meson.build            |   1 +\n>  include/libcamera/request.h              |   4 +\n>  src/libcamera/controls.cpp               | 310 +++++++++++++++++++++++\n>  src/libcamera/include/pipeline_handler.h |   3 +\n>  src/libcamera/meson.build                |   1 +\n>  src/libcamera/pipeline/ipu3/ipu3.cpp     |  19 ++\n>  src/libcamera/pipeline/raspberrypi.cpp   | 108 +++++++-\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp |  19 ++\n>  src/libcamera/pipeline/uvcvideo.cpp      | 127 +++++++++-\n>  src/libcamera/pipeline/vimc.cpp          |  19 ++\n>  src/qcam/main_window.cpp                 |  24 ++\n>  12 files changed, 739 insertions(+), 2 deletions(-)\n>  create mode 100644 include/libcamera/controls.h\n>  create mode 100644 src/libcamera/controls.cpp\n> \n> -- \n> 2.20.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DB7346A16E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  7 Jun 2019 17:52:10 +0200 (CEST)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:a03f:44f0:8500:ca05:8177:199c:fed4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A615334;\n\tFri,  7 Jun 2019 17:52:09 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1559922729;\n\tbh=RpaOZhpmNGUcwF0LAZghvYSxofxio0rbBVabS/b1lnk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uQ7SEj3gSqB8eQb2eKN0nKnrW3Zzkr8Qw9xnxsCKt2eWcfFx1ze4blFf/FiedNXhs\n\tF6FBz5l9uK0XBA68OUNCl5xAqLwKRzUcdM0RdHpCJ127ToM65aQVc42tjwPPn3JK3E\n\t8L2Dvu+EeslY0jwKdGAQXT6RBAKhOKQ61MIwuNvQ=","Date":"Fri, 7 Jun 2019 18:51:55 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20190607155155.GQ7593@pendragon.ideasonboard.com>","References":"<20190606205654.9311-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190606205654.9311-1-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [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":"<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>","X-List-Received-Date":"Fri, 07 Jun 2019 15:52:11 -0000"}}]