[{"id":322,"web_url":"https://patchwork.libcamera.org/comment/322/","msgid":"<dd956f27-c382-410b-1d54-6c6468b40e7b@ideasonboard.com>","date":"2019-01-15T15:19:25","subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: media_object: Add\n\tfunctions to entities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 15/01/2019 14:07, 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 and remove a stale TODO entry.\n> \n\nI jumped to the next patch first to see how this was used.\n\nIt seems reasonable to me:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/media_object.h |  2 ++\n>  src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n>  2 files changed, 15 insertions(+), 5 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..c47fb53 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\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> + * name() unique in the media device context, a function() and its associated\n> + * devnode, if any.\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 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 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>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A243760C78\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 16:19:28 +0100 (CET)","from [192.168.0.21]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F41484F8;\n\tTue, 15 Jan 2019 16:19:27 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1547565568;\n\tbh=VpdjFkKze2de82DaObk2quvJiDKo2fncX+tIgUiH3B0=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=MIw3uCJyxxr2n7GD2bQ/KNPLaY7KQa11akGHARbbd64Bww6riMDg4lAfHQ1+9sefG\n\tcguPtyKcQx81uQpNb3GZhFBRJ5WDAa2uNfqNGZJAUa5o9iyMKuyLPPn8jaIFeVOx7J\n\tj2/F/C0kLYYtwwxCExsAYBnxRyGo1hgEL8ltPrHY=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20190115140749.8297-1-jacopo@jmondi.org>\n\t<20190115140749.8297-4-jacopo@jmondi.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko\n\tlPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq\n\t8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/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DbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<dd956f27-c382-410b-1d54-6c6468b40e7b@ideasonboard.com>","Date":"Tue, 15 Jan 2019 15:19:25 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.2.1","MIME-Version":"1.0","In-Reply-To":"<20190115140749.8297-4-jacopo@jmondi.org>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 15:19:28 -0000"}},{"id":324,"web_url":"https://patchwork.libcamera.org/comment/324/","msgid":"<9859973.cov480AbNd@avalon>","date":"2019-01-15T15:57:27","subject":"Re: [libcamera-devel] [PATCH 3/4] 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 Tuesday, 15 January 2019 16:07:48 EET 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\n> provide a getter function for that.\n> \n> While at there update comments and remove a stale TODO entry.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/media_object.h |  2 ++\n>  src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n>  2 files changed, 15 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/include/media_object.h\n> b/src/libcamera/include/media_object.h 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..c47fb53 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\n>   * API in the media_v2_entity structure. They reference the pads() they\n> contain. *\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\n> integrating - * with DeviceEnumerator.\n> + * name() unique in the media device context, a function() and its\n> associated + * devnode, if any.\n\nThe entity isn't \"identified\" by its function or devnode. How about\n\n * In addition to their graph id, media graph entities are identified by a\n * name() unique in the media device context. Their implement a function(),\n * and may expose a devnode().\n\nBy the way the devnode isn't even set in the existing code, neither it is \naccessed :-) Is that an oversight ?\n\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 main function\n\ns/entity/entity's/ ?\n\nApart from that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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 function\n> + */\n> +\n>  /**\n>   * \\fn MediaEntity::deviceMajor()\n>   * \\brief Retrieve the major number of the interface associated with the\n> entity @@ -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>  }","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 C873660B0C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 16:56:11 +0100 (CET)","from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2928A4F8;\n\tTue, 15 Jan 2019 16:56:11 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1547567771;\n\tbh=yxVzDwfFu2EuPbZNGAZQWyZJlu+AAjKsLRchpacEqGk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kK2GW0LcDiYTd9G3/H/wZO33H4km18/8WfsWhWSfhQ+oUzBzpWMYNUVs3c3tYIvKX\n\t35aBF82N+jTDABiGTGLlwRMG9DFzp0rHN5MNbwseey5lgDOdz00Puna/l57PxRDKJ4\n\tA3EyxUv3/OJ5rCG0jBOmBNk0+kzTblv4cLV31NFs=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 15 Jan 2019 17:57:27 +0200","Message-ID":"<9859973.cov480AbNd@avalon>","Organization":"Ideas on Board Oy","In-Reply-To":"<20190115140749.8297-4-jacopo@jmondi.org>","References":"<20190115140749.8297-1-jacopo@jmondi.org>\n\t<20190115140749.8297-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"7Bit","Content-Type":"text/plain; charset=\"us-ascii\"","Subject":"Re: [libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 15:56:12 -0000"}},{"id":326,"web_url":"https://patchwork.libcamera.org/comment/326/","msgid":"<20190115160658.j2b5jg74eki6y5yv@uno.localdomain>","date":"2019-01-15T16:06:58","subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: media_object: Add\n\tfunctions to entities","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Jan 15, 2019 at 05:57:27PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Tuesday, 15 January 2019 16:07:48 EET 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\n> > provide a getter function for that.\n> >\n> > While at there update comments and remove a stale TODO entry.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/media_object.h |  2 ++\n> >  src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n> >  2 files changed, 15 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/libcamera/include/media_object.h\n> > b/src/libcamera/include/media_object.h 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..c47fb53 100644\n> > --- a/src/libcamera/media_object.cpp\n> > +++ b/src/libcamera/media_object.cpp\n> > @@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\n> >   * API in the media_v2_entity structure. They reference the pads() they\n> > contain. *\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\n> > integrating - * with DeviceEnumerator.\n> > + * name() unique in the media device context, a function() and its\n> > associated + * devnode, if any.\n>\n> The entity isn't \"identified\" by its function or devnode. How about\n\nI tried summarize here what 'identity' informations a media entity\ntransports. If that's confusing I'll remove it.\n\n>\n>  * In addition to their graph id, media graph entities are identified by a\n>  * name() unique in the media device context. Their implement a function(),\n\nThey\n\n>  * and may expose a devnode().\n>\n> By the way the devnode isn't even set in the existing code, neither it is\n> accessed :-) Is that an oversight ?\n\nI didn't get this... The devnode *might* be set.. I think that's\ncaptured in your comment here above, so I'll include that.\n\n\n>\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 main function\n>\n> s/entity/entity's/ ?\n>\n> Apart from that,\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nThanks\n  j\n\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 function\n> > + */\n> > +\n> >  /**\n> >   * \\fn MediaEntity::deviceMajor()\n> >   * \\brief Retrieve the major number of the interface associated with the\n> > entity @@ -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> Regards,\n>\n> Laurent Pinchart\n>\n>\n>","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A375E60C86\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 17:06:49 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 260F460006;\n\tTue, 15 Jan 2019 16:06:48 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 15 Jan 2019 17:06:58 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190115160658.j2b5jg74eki6y5yv@uno.localdomain>","References":"<20190115140749.8297-1-jacopo@jmondi.org>\n\t<20190115140749.8297-4-jacopo@jmondi.org>\n\t<9859973.cov480AbNd@avalon>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"ecjnvskhikv5ik3n\"","Content-Disposition":"inline","In-Reply-To":"<9859973.cov480AbNd@avalon>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 16:06:49 -0000"}},{"id":329,"web_url":"https://patchwork.libcamera.org/comment/329/","msgid":"<3025450.bTopHhVLUR@avalon>","date":"2019-01-15T16:35:11","subject":"Re: [libcamera-devel] [PATCH 3/4] 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\nOn Tuesday, 15 January 2019 18:06:58 EET Jacopo Mondi wrote:\n> On Tue, Jan 15, 2019 at 05:57:27PM +0200, Laurent Pinchart wrote:\n> > On Tuesday, 15 January 2019 16:07:48 EET 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\n> >> provide a getter function for that.\n> >> \n> >> While at there update comments and remove a stale TODO entry.\n> >> \n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >> \n> >>  src/libcamera/include/media_object.h |  2 ++\n> >>  src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n> >>  2 files changed, 15 insertions(+), 5 deletions(-)\n\n[snip]\n\n> >> diff --git a/src/libcamera/media_object.cpp\n> >> b/src/libcamera/media_object.cpp index cb3af85..c47fb53 100644\n> >> --- a/src/libcamera/media_object.cpp\n> >> +++ b/src/libcamera/media_object.cpp\n> >> @@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\n> >>   * API in the media_v2_entity structure. They reference the pads() they\n> >> contain.\n> >>   *\n> >>   * In addition to its graph id, every media graph entity is identified\n> >>   by a\n> >> - * name() unique in the media device context.\n> >> - *\n> >> - * \\todo Add support for associating a devnode to the entity when\n> >> integrating - * with DeviceEnumerator.\n> >> + * name() unique in the media device context, a function() and its\n> >> associated + * devnode, if any.\n> > \n> > The entity isn't \"identified\" by its function or devnode. How about\n> \n> I tried summarize here what 'identity' informations a media entity\n> transports. If that's confusing I'll remove it.\n\nI'm just nitpicking on the wording :-)\n\n> >  * In addition to their graph id, media graph entities are identified by a\n> >  * name() unique in the media device context. Their implement a\n> >  function(),\n> \n> They\n\nOops.\n\n> >  * and may expose a devnode().\n> > \n> > By the way the devnode isn't even set in the existing code, neither it is\n> > accessed :-) Is that an oversight ?\n> \n> I didn't get this... The devnode *might* be set.. I think that's\n> captured in your comment here above, so I'll include that.\n\nUnless I'm mistaken, setDeviceNode() doesn't assign devnode_, and devnode_ is \nnever used.\n\n> >>   */\n\n[snip]","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 C951560C88\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 17:33:55 +0100 (CET)","from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E5894F8;\n\tTue, 15 Jan 2019 17:33:55 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1547570035;\n\tbh=/gdkjPNbUeaejeAeSPXd3rABNqR49AhmVo6VweArel0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e/fhyHOgGZ0YYsxCmdYvJR0dBdghvWz+4UlUbRpe9SbCByqwh8s2bewiXcDl/QWwC\n\twAYabAdYwgqCKzJo1/3Vsktg+lPZkPBscpkzPMcL+384pqSguyGJ6wA/4R/sBSsjYw\n\tN2iPS1np7a2nSJO3fIBg4Guqqugbtb/nyF7yJUE4=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Date":"Tue, 15 Jan 2019 18:35:11 +0200","Message-ID":"<3025450.bTopHhVLUR@avalon>","Organization":"Ideas on Board Oy","In-Reply-To":"<20190115160658.j2b5jg74eki6y5yv@uno.localdomain>","References":"<20190115140749.8297-1-jacopo@jmondi.org>\n\t<9859973.cov480AbNd@avalon>\n\t<20190115160658.j2b5jg74eki6y5yv@uno.localdomain>","MIME-Version":"1.0","Content-Transfer-Encoding":"7Bit","Content-Type":"text/plain; charset=\"us-ascii\"","Subject":"Re: [libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 16:33:55 -0000"}},{"id":331,"web_url":"https://patchwork.libcamera.org/comment/331/","msgid":"<20190115164354.o5tvwymdwlif7f7s@uno.localdomain>","date":"2019-01-15T16:43:54","subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: media_object: Add\n\tfunctions to entities","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Jan 15, 2019 at 06:35:11PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> On Tuesday, 15 January 2019 18:06:58 EET Jacopo Mondi wrote:\n> > On Tue, Jan 15, 2019 at 05:57:27PM +0200, Laurent Pinchart wrote:\n> > > On Tuesday, 15 January 2019 16:07:48 EET 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\n> > >> provide a getter function for that.\n> > >>\n> > >> While at there update comments and remove a stale TODO entry.\n> > >>\n> > >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > >> ---\n> > >>\n> > >>  src/libcamera/include/media_object.h |  2 ++\n> > >>  src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n> > >>  2 files changed, 15 insertions(+), 5 deletions(-)\n>\n> [snip]\n>\n> > >> diff --git a/src/libcamera/media_object.cpp\n> > >> b/src/libcamera/media_object.cpp index cb3af85..c47fb53 100644\n> > >> --- a/src/libcamera/media_object.cpp\n> > >> +++ b/src/libcamera/media_object.cpp\n> > >> @@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\n> > >>   * API in the media_v2_entity structure. They reference the pads() they\n> > >> contain.\n> > >>   *\n> > >>   * In addition to its graph id, every media graph entity is identified\n> > >>   by a\n> > >> - * name() unique in the media device context.\n> > >> - *\n> > >> - * \\todo Add support for associating a devnode to the entity when\n> > >> integrating - * with DeviceEnumerator.\n> > >> + * name() unique in the media device context, a function() and its\n> > >> associated + * devnode, if any.\n> > >\n> > > The entity isn't \"identified\" by its function or devnode. How about\n> >\n> > I tried summarize here what 'identity' informations a media entity\n> > transports. If that's confusing I'll remove it.\n>\n> I'm just nitpicking on the wording :-)\n>\n> > >  * In addition to their graph id, media graph entities are identified by a\n> > >  * name() unique in the media device context. Their implement a\n> > >  function(),\n> >\n> > They\n>\n> Oops.\n>\n> > >  * and may expose a devnode().\n> > >\n> > > By the way the devnode isn't even set in the existing code, neither it is\n> > > accessed :-) Is that an oversight ?\n> >\n> > I didn't get this... The devnode *might* be set.. I think that's\n> > captured in your comment here above, so I'll include that.\n>\n> Unless I'm mistaken, setDeviceNode() doesn't assign devnode_, and devnode_ is\n> never used.\n\nint MediaEntity::setDeviceNode(const std::string &devnode)\n{\n\t/* Make sure the device node can be accessed. */\n\tint ret = ::access(devnode.c_str(), R_OK | W_OK);\n\tif (ret < 0) {\n\t\tret = -errno;\n\t\tLOG(Error) << \"Device node \" << devnode << \" can't be accessed: \"\n\t\t\t   << strerror(-ret);\n\t\treturn ret;\n\t}\n\n\treturn 0;\n}\n\nThis is a \"bug\" (better, this should assign devnode_). I have no idea\nwhy it is not there.... I'll send a patch soon, as the entity devnode\nwill be required when we'll start creating V4L2Devices from\nMediaEntities.\n\n\n>\n> > >>   */\n>\n> [snip]\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n>\n>","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E7ED60C88\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 17:43:45 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 0DD6820008;\n\tTue, 15 Jan 2019 16:43:44 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 15 Jan 2019 17:43:54 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190115164354.o5tvwymdwlif7f7s@uno.localdomain>","References":"<20190115140749.8297-1-jacopo@jmondi.org>\n\t<9859973.cov480AbNd@avalon>\n\t<20190115160658.j2b5jg74eki6y5yv@uno.localdomain>\n\t<3025450.bTopHhVLUR@avalon>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"b73cpvbul2lsnygj\"","Content-Disposition":"inline","In-Reply-To":"<3025450.bTopHhVLUR@avalon>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 16:43:45 -0000"}}]