[{"id":884,"web_url":"https://patchwork.libcamera.org/comment/884/","msgid":"<20190226024403.GJ899@bigcity.dyn.berto.se>","date":"2019-02-26T02:44:03","subject":"Re: [libcamera-devel] [PATCH v2 3/6] libcamera: v4l2_device: Add\n\tsupport for META_CAPTURE devices","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your patch.\n\nOn 2019-02-25 13:10:34 +0100, Jacopo Mondi wrote:\n> Add support for devices that provide video meta-data to v4l2_device.cpp\n> and re-arrange bufferType handling in open() method.\n\nI would split this in two, one patch to merge the logic in open() and \none adding META_CAPTURE support. I don't feel strongly about this so if \nyou prefer this approach I'm fine with it.\n\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_device.h |  4 +++\n>  src/libcamera/v4l2_device.cpp       | 38 +++++++++++++++++------------\n>  2 files changed, 27 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 1d31d1b403bc..52eb6785cc15 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -53,6 +53,10 @@ struct V4L2Capability final : v4l2_capability {\n>  \t\treturn device_caps() & (V4L2_CAP_VIDEO_CAPTURE |\n>  \t\t\t\t\tV4L2_CAP_VIDEO_CAPTURE_MPLANE);\n>  \t}\n> +\tbool isMeta() const\n> +\t{\n> +\t\treturn device_caps() & V4L2_CAP_META_CAPTURE;\n> +\t}\n>  \tbool isOutput() const\n>  \t{\n>  \t\treturn device_caps() & (V4L2_CAP_VIDEO_OUTPUT |\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 24e115554a99..8be8af7a2893 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -79,6 +79,15 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   * \\return True if the device can output video frames\n>   */\n>  \n> +/**\n> + * \\fn bool V4L2Capability::isMeta()\n> + * \\brief Identify if the device is capable of providing video meta-data\n> + *\n> + * FIXME: add support for META_OUTPUT, introduced in Linux v4.20\n\ns|FIXME:|\\todo|\n\nWith this fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> + *\n> + * \\return True if the device can provide video meta-data\n> + */\n> +\n>  /**\n>   * \\fn bool V4L2Capability::hasStreaming()\n>   * \\brief Determine if the device can perform Streaming I/O\n> @@ -280,33 +289,32 @@ int V4L2Device::open()\n>  \t\t<< \"Opened device \" << caps_.bus_info() << \": \"\n>  \t\t<< caps_.driver() << \": \" << caps_.card();\n>  \n> -\tif (!caps_.isCapture() && !caps_.isOutput()) {\n> -\t\tLOG(V4L2, Debug) << \"Device is not a supported type\";\n> -\t\treturn -EINVAL;\n> -\t}\n> -\n>  \tif (!caps_.hasStreaming()) {\n>  \t\tLOG(V4L2, Error) << \"Device does not support streaming I/O\";\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n> -\tif (caps_.isCapture())\n> +\t/*\n> +\t * Set buffer type and wait for read notifications on CAPTURE devices\n> +\t * (POLLIN), and write notifications for OUTPUT devices (POLLOUT).\n> +\t */\n> +\tif (caps_.isCapture()) {\n> +\t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Read);\n>  \t\tbufferType_ = caps_.isMultiplanar()\n>  \t\t\t    ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE\n>  \t\t\t    : V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> -\telse\n> +\t} else if (caps_.isOutput()) {\n> +\t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Write);\n>  \t\tbufferType_ = caps_.isMultiplanar()\n>  \t\t\t    ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE\n>  \t\t\t    : V4L2_BUF_TYPE_VIDEO_OUTPUT;\n> -\n> -\t/*\n> -\t *  We wait for Read notifications on CAPTURE devices (POLLIN), and\n> -\t *  Write notifications for OUTPUT devices (POLLOUT).\n> -\t */\n> -\tif (caps_.isCapture())\n> +\t} else if (caps_.isMeta()) {\n>  \t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Read);\n> -\telse\n> -\t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Write);\n> +\t\tbufferType_ = V4L2_BUF_TYPE_META_CAPTURE;\n> +\t} else {\n> +\t\tLOG(V4L2, Debug) << \"Device is not a supported type\";\n> +\t\treturn -EINVAL;\n> +\t}\n>  \n>  \tfdEvent_->activated.connect(this, &V4L2Device::bufferAvailable);\n>  \tfdEvent_->setEnabled(false);\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":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 38876601E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Feb 2019 03:44:05 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id g2so8461765lfh.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Feb 2019 18:44:05 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tn11sm2469867ljg.55.2019.02.25.18.44.03\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 25 Feb 2019 18:44:03 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=gnmkAMImHEcwe9XMYIcqRetDoS8dz+hjTdwx9HQdrow=;\n\tb=i8p+fY/YOXYL4sqoT6cvi3eYyC0npf9LuzL4pBQYBZcxLWiIPiP6C+uhhIdfqsP86r\n\tQQjsnJjxCReKcflWWSI9lSiIZ6iy3e3xi1zvQp72jQFy/5+Jf6udUMKLaUthnMYjbX8+\n\tS11oxy5LMxk1uSlgVCdeayKa4QPNs8PqH2H6HSeGkHIdJdoFyM06LFuWiSTGcbIA8wbs\n\tzXoI1CzQtto3Dqj/XHV+fQqnPZi9Btf2wsO7xLE5sgl/NELhAkDEKAKacakFu8tlgqX2\n\txpqc2sWp0byofj8wCTM9C5ZhFRNnbFAlA70RkGbpcs4xcvuaR860mPBQfrtgFg1UKkvS\n\tbJKw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=gnmkAMImHEcwe9XMYIcqRetDoS8dz+hjTdwx9HQdrow=;\n\tb=fxeSo0kIiaRZUYHw9vZrtlJ5HKVRgzRjk0wOFUh7WW4TtvzaqPTpwIwiC8s8ErM0/p\n\t+ya1FTza8L5TUwdsAUR9+SDNP5JCXxXDNtnqaQO6b7FVptOmqfejGbmWaGmASKuSvK1G\n\tZr/fQfr8v+63WPIM7hkAIHJXyXTpotNEtOVX9MM7mOQCFB/iROwh7k08AGdLY8NBenk+\n\tkWTWM35mq2xRN0hsiuRk/ozyVXJMB/GEPL0RVDcANQkt6G2LoSkuN3YgW/ARNVyP4n0h\n\ttOnbMDMpn4zC5v4Y6UczxN4gN29XacgJqQo8d4BDiYrKKYq6Vr1hMUf255a5suOP8agH\n\tAM1g==","X-Gm-Message-State":"AHQUAuYXjUUhw2za3m05Pnan6VU2M58z3nbR/viNcsx0H+ThzIynBnjp\n\tp0ac18NAF7tgc1RTZ18Cg1k3GQ==","X-Google-Smtp-Source":"AHgI3IZ0P18JDyNofdTkBqO1Xry5j1Kt4+Uq9MoZgA22J4cxJFD+8Z/rxFQYJhStxaoeq4uP6dei7w==","X-Received":"by 2002:a19:2d44:: with SMTP id t4mr11652518lft.90.1551149044420;\n\tMon, 25 Feb 2019 18:44:04 -0800 (PST)","Date":"Tue, 26 Feb 2019 03:44:03 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190226024403.GJ899@bigcity.dyn.berto.se>","References":"<20190225121037.11415-1-jacopo@jmondi.org>\n\t<20190225121037.11415-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190225121037.11415-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 3/6] libcamera: v4l2_device: Add\n\tsupport for META_CAPTURE devices","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":"Tue, 26 Feb 2019 02:44:05 -0000"}}]