[{"id":368,"web_url":"https://patchwork.libcamera.org/comment/368/","msgid":"<20190116151512.GF6484@bigcity.dyn.berto.se>","date":"2019-01-16T15:15:12","subject":"Re: [libcamera-devel] [PATCH v2 2/5] libcamera: media_object: Add\n\tfunctions to entities","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 work.\n\nOn 2019-01-16 14:59:46 +0100, Jacopo Mondi wrote:\n> Media entities convey information about their main function in the\n> 'function' field of 'struct media_v2_entity'.\n> \n> Store the main function in the MediaEntity function_ class member and provide\n> a getter function for that.\n> \n> While at there update comments, keep the MediaPad description in sync\n> with the MediaEntity one and remove a stale TODO entry.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nI would have split this patch in two, one updating the documentation and \none adding the new functionality. If you choose to keep this as one or \nsplit it in to feel free to add to (both)\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/media_object.h |  2 ++\n>  src/libcamera/media_object.cpp       | 22 +++++++++++++++-------\n>  2 files changed, 17 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h\n> index 7fc4441..a10f7e1 100644\n> --- a/src/libcamera/include/media_object.h\n> +++ b/src/libcamera/include/media_object.h\n> @@ -84,6 +84,7 @@ class MediaEntity : public MediaObject\n>  {\n>  public:\n>  \tconst std::string &name() const { return name_; }\n> +\tunsigned int function() const { return function_; }\n>  \tunsigned int deviceMajor() const { return major_; }\n>  \tunsigned int deviceMinor() const { return minor_; }\n>  \n> @@ -103,6 +104,7 @@ private:\n>  \t~MediaEntity();\n>  \n>  \tstd::string name_;\n> +\tunsigned int function_;\n>  \tstd::string devnode_;\n>  \tunsigned int major_;\n>  \tunsigned int minor_;\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index cb3af85..76dd326 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -166,7 +166,7 @@ MediaLink::MediaLink(const struct media_v2_link *link, MediaPad *source,\n>   * Pads are created from the information provided by the Media Controller API\n>   * in the media_v2_pad structure. They reference the entity() they belong to.\n>   *\n> - * In addition to its graph id, every media graph pad is identified by an index\n> + * In addition to its graph id, media graph pads are identified by an index\n>   * unique in the context of the entity the pad belongs to.\n>   *\n>   * A pad can be either a 'source' pad or a 'sink' pad. This information is\n> @@ -242,11 +242,9 @@ void MediaPad::addLink(MediaLink *link)\n>   * Entities are created from the information provided by the Media Controller\n>   * API in the media_v2_entity structure. They reference the pads() they contain.\n>   *\n> - * In addition to its graph id, every media graph entity is identified by a\n> - * name() unique in the media device context.\n> - *\n> - * \\todo Add support for associating a devnode to the entity when integrating\n> - * with DeviceEnumerator.\n> + * In addition to its graph id, media graph entities are identified by a\n> + * name() unique in the media device context. They implement a function() and\n> + * may expose a devnode().\n>   */\n>  \n>  /**\n> @@ -255,6 +253,16 @@ void MediaPad::addLink(MediaLink *link)\n>   * \\return The entity name\n>   */\n>  \n> +/**\n> + * \\fn MediaEntity::function()\n> + * \\brief Retrieve the entity's main function\n> + *\n> + * Media entity functions are expressed using the MEDIA_ENT_F_* macros\n> + * defined by the Media Controller API.\n> + *\n> + * \\return The entity's function\n> + */\n> +\n>  /**\n>   * \\fn MediaEntity::deviceMajor()\n>   * \\brief Retrieve the major number of the interface associated with the entity\n> @@ -336,7 +344,7 @@ MediaEntity::MediaEntity(MediaDevice *dev,\n>  \t\t\t const struct media_v2_entity *entity,\n>  \t\t\t unsigned int major, unsigned int minor)\n>  \t: MediaObject(dev, entity->id), name_(entity->name),\n> -\t  major_(major), minor_(minor)\n> +\t  function_(entity->function), major_(major), minor_(minor)\n>  {\n>  }\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":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4BC3660B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jan 2019 16:15:15 +0100 (CET)","by mail-lj1-x241.google.com with SMTP id q2-v6so5720430lji.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jan 2019 07:15:15 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ta127sm1233209lfe.73.2019.01.16.07.15.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 16 Jan 2019 07:15:13 -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=j7Was3KeNUf9jHGm5ffQJxsIIEPvxJDtmixSqz5CLHU=;\n\tb=k84CR66M3L5cayj5E5OZ5Z+GZ0PLi4F6dhAt2B5YJrqe1aygDQnXNMs95fMEO8NAET\n\tiWEEIVnQI1vN+CMl9Bk6QhBDblGM0xjuOUQy+RAsvORNQcy9bDmVhVowMwwVYBLoY6Lf\n\tz11vnTnlslk+lxLr56l/6LGHTMh7ZqWR9812H+XAuZVecLicF6wbkwIhpyZWi5sTPjeN\n\t+sQOMU7cp/i/q1OinwykTy8hTqcgHSaf85Jb3Z14hVcEHfSITVAn9DCtfoA9Y/PDHCLW\n\t/wkwt1QHty12r4Wz9sLWTWIpHPEABkKW54nrX6E7hdFWO5Wpc8DUMYJRT5v60HAgXEGP\n\tSNMw==","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=j7Was3KeNUf9jHGm5ffQJxsIIEPvxJDtmixSqz5CLHU=;\n\tb=lbE+BYdsv7rZvmqTb6JitqXETfpbtQyj67zSYNS8QnnrxCWQp4/aQTb9UyqMJWrr/Z\n\t4H2fsvW9x8YZceNTLQx9NxZ/xEqVeHjXD3mw2LHJI643rh3TV7A1a1mz/ILUj3LA10GN\n\txEwDyWHMq69x8tJza1vVkbaaHEinTzKb5h1WbxkvHhKpO4NqfN0SvzzDxCg60+d5g1qT\n\tPAk9Fj2jXk734OqnbBv1Bsty5/syWhO05nhm+56dJlxejjwRdgNeUUZMz4YM1kYMV3PW\n\tZKasYhIcn8DyZCPcsOnuHOxUu+u5TFfXOmvTW+/D7EwyAWQNZR2sxAlS7oVOuu+lWrBD\n\tV6cw==","X-Gm-Message-State":"AJcUukfmS6nh7shnHPrK1W4el2V6tvh3GRPkmmxWPqHYl5rgb1kEHp/5\n\tww2OgSX0tvPF2G5oeqK1tynsTA==","X-Google-Smtp-Source":"ALg8bN5ktj6dOk7ysKq1DYmhfhu3DTjN2X6cZiFeUDPl23winLKNuoM1dc3TtW815eeNbX2wJH7GCA==","X-Received":"by 2002:a2e:7c13:: with SMTP id\n\tx19-v6mr6911284ljc.83.1547651714507; \n\tWed, 16 Jan 2019 07:15:14 -0800 (PST)","Date":"Wed, 16 Jan 2019 16:15:12 +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":"<20190116151512.GF6484@bigcity.dyn.berto.se>","References":"<20190116135949.2097-1-jacopo@jmondi.org>\n\t<20190116135949.2097-3-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":"<20190116135949.2097-3-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 2/5] libcamera: media_object: Add\n\tfunctions to entities","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":"Wed, 16 Jan 2019 15:15:15 -0000"}},{"id":400,"web_url":"https://patchwork.libcamera.org/comment/400/","msgid":"<20190118005926.GK23244@pendragon.ideasonboard.com>","date":"2019-01-18T00:59:26","subject":"Re: [libcamera-devel] [PATCH v2 2/5] libcamera: media_object: Add\n\tfunctions to entities","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Jan 16, 2019 at 02:59:46PM +0100, Jacopo Mondi wrote:\n> Media entities convey information about their main function in the\n> 'function' field of 'struct media_v2_entity'.\n> \n> Store the main function in the MediaEntity function_ class member and provide\n> a getter function for that.\n> \n> While at there update comments, keep the MediaPad description in sync\n> with the MediaEntity one and remove a stale TODO entry.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/media_object.h |  2 ++\n>  src/libcamera/media_object.cpp       | 22 +++++++++++++++-------\n>  2 files changed, 17 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h\n> index 7fc4441..a10f7e1 100644\n> --- a/src/libcamera/include/media_object.h\n> +++ b/src/libcamera/include/media_object.h\n> @@ -84,6 +84,7 @@ class MediaEntity : public MediaObject\n>  {\n>  public:\n>  \tconst std::string &name() const { return name_; }\n> +\tunsigned int function() const { return function_; }\n>  \tunsigned int deviceMajor() const { return major_; }\n>  \tunsigned int deviceMinor() const { return minor_; }\n>  \n> @@ -103,6 +104,7 @@ private:\n>  \t~MediaEntity();\n>  \n>  \tstd::string name_;\n> +\tunsigned int function_;\n>  \tstd::string devnode_;\n>  \tunsigned int major_;\n>  \tunsigned int minor_;\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index cb3af85..76dd326 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -166,7 +166,7 @@ MediaLink::MediaLink(const struct media_v2_link *link, MediaPad *source,\n>   * Pads are created from the information provided by the Media Controller API\n>   * in the media_v2_pad structure. They reference the entity() they belong to.\n>   *\n> - * In addition to its graph id, every media graph pad is identified by an index\n> + * In addition to its graph id, media graph pads are identified by an index\n\ns/its/their/\n\n>   * unique in the context of the entity the pad belongs to.\n>   *\n>   * A pad can be either a 'source' pad or a 'sink' pad. This information is\n> @@ -242,11 +242,9 @@ void MediaPad::addLink(MediaLink *link)\n>   * Entities are created from the information provided by the Media Controller\n>   * API in the media_v2_entity structure. They reference the pads() they contain.\n>   *\n> - * In addition to its graph id, every media graph entity is identified by a\n> - * name() unique in the media device context.\n> - *\n> - * \\todo Add support for associating a devnode to the entity when integrating\n> - * with DeviceEnumerator.\n> + * In addition to its graph id, media graph entities are identified by a\n\nDitto.\n\nWith these fixed you can keep my ack and push this patch.\n\n> + * name() unique in the media device context. They implement a function() and\n> + * may expose a devnode().\n>   */\n>  \n>  /**\n> @@ -255,6 +253,16 @@ void MediaPad::addLink(MediaLink *link)\n>   * \\return The entity name\n>   */\n>  \n> +/**\n> + * \\fn MediaEntity::function()\n> + * \\brief Retrieve the entity's main function\n> + *\n> + * Media entity functions are expressed using the MEDIA_ENT_F_* macros\n> + * defined by the Media Controller API.\n> + *\n> + * \\return The entity's function\n> + */\n> +\n>  /**\n>   * \\fn MediaEntity::deviceMajor()\n>   * \\brief Retrieve the major number of the interface associated with the entity\n> @@ -336,7 +344,7 @@ MediaEntity::MediaEntity(MediaDevice *dev,\n>  \t\t\t const struct media_v2_entity *entity,\n>  \t\t\t unsigned int major, unsigned int minor)\n>  \t: MediaObject(dev, entity->id), name_(entity->name),\n> -\t  major_(major), minor_(minor)\n> +\t  function_(entity->function), major_(major), minor_(minor)\n>  {\n>  }\n>","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 261FF60C83\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jan 2019 01:59:27 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 778E953F;\n\tFri, 18 Jan 2019 01:59:26 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1547773166;\n\tbh=t5cmkDxv/djK72Y6CsPMllBiNUBNirBw88QHRrm3M24=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YvYtSUujGyr5ar8qi0QsXMMlWkArzlLVn6H3mpMMirBxMYfofU9yolHaPblRuv+xT\n\t8Px/8pXVf98tQQjSBWnm3pd/TCeG+lU1KlbFtGqN6V74L/u7GlHqSDxBQjgLE7RRB/\n\tuukpbP9vgSqhEklpdmHeZsNU7EobIBXCpxcf0ALY=","Date":"Fri, 18 Jan 2019 02:59:26 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20190118005926.GK23244@pendragon.ideasonboard.com>","References":"<20190116135949.2097-1-jacopo@jmondi.org>\n\t<20190116135949.2097-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190116135949.2097-3-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 2/5] libcamera: media_object: Add\n\tfunctions to entities","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, 18 Jan 2019 00:59:27 -0000"}}]