[{"id":882,"web_url":"https://patchwork.libcamera.org/comment/882/","msgid":"<20190226023025.GH899@bigcity.dyn.berto.se>","date":"2019-02-26T02:30:25","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: v4l2_subdevice:\n\tStore media entity","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:32 +0100, Jacopo Mondi wrote:\n> Store the media entity backing the V4L2Subdevice and add a deviceName()\n> method to retrieve the human readable name of the subdevice, which is\n> created using the name of the associated media entity.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_subdevice.h | 5 ++++-\n>  src/libcamera/v4l2_subdevice.cpp       | 9 ++++++++-\n>  2 files changed, 12 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 82fa6685ab52..fcfbee5af106 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -9,9 +9,10 @@\n>  \n>  #include <string>\n>  \n> +#include \"media_object.h\"\n> +\n>  namespace libcamera {\n>  \n> -class MediaEntity;\n>  struct Rectangle;\n>  \n>  struct V4L2SubdeviceFormat {\n> @@ -32,6 +33,7 @@ public:\n>  \tvoid close();\n>  \n>  \tstd::string deviceNode() const { return deviceNode_; }\n> +\tstd::string deviceName() const { return entity_->name(); }\n>  \n>  \tint setCrop(unsigned int pad, Rectangle *rect);\n>  \tint setCompose(unsigned int pad, Rectangle *rect);\n> @@ -43,6 +45,7 @@ private:\n>  \tint setSelection(unsigned int pad, unsigned int target,\n>  \t\t\t Rectangle *rect);\n>  \n> +\tconst MediaEntity *entity_;\n>  \tstd::string deviceNode_;\n>  \tint fd_;\n>  };\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index b436f73cc75f..ebf87f0124cb 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -88,7 +88,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n>   * path\n>   */\n>  V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)\n> -\t: deviceNode_(entity->deviceNode()), fd_(-1)\n> +\t: entity_(entity), deviceNode_(entity->deviceNode()), fd_(-1)\n\nThis looks odd. Can't you remove the deviceNode_ member of \nV4L2SubdeviceFormat and use the same schema to retrieve it as \ndeviceName?\n\n    std::string deviceNode() const { return entity_->deviceNode(); }\n    std::string deviceName() const { return entity_->name(); }\n\n>  {\n>  }\n>  \n> @@ -147,6 +147,13 @@ void V4L2Subdevice::close()\n>   * \\return The subdevice's device node system path\n>   */\n>  \n> +/**\n> + * \\fn V4L2Subdevice::deviceName()\n> + * \\brief Retrieve the name of the media entity associated with the subdevice\n> + *\n> + * \\return The name of the media entity the subdevice is associated to\n> + */\n> +\n>  /**\n>   * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n>   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\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 F36E6601E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Feb 2019 03:30:27 +0100 (CET)","by mail-lj1-x241.google.com with SMTP id g80so9340146ljg.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Feb 2019 18:30:27 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tx64sm1875873lff.3.2019.02.25.18.30.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 25 Feb 2019 18:30:26 -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=GhQypdrhXyhvhVzF4Xa/xyCqs68rNpQZTASJYYuErR4=;\n\tb=v2ayq7ULtLG3mwu8oOustvmg+1s+edWxCY4/mFNS8HyU9tJftT2ZVD04yhwt1We9KD\n\todM5ho9BDpdwXksJAJCC399iVbaQ2J/e5UEe39xV2lpxt9wG2u/Ube3qCLdMDUDZChwU\n\t2FsaFjgvN2RpRF5gYA6Y8v0kkK0UrtpIFUXs0/sLwfh1m5FHe0I/1hewvgXvyG2+L/SB\n\txgy6dO09q8LTtB9SA0PEyg2dlIpSYLtxaLTK+0725iSxqyakmmf4vrAdw1Lma+F099VS\n\tflQjsKqIDJtLI8pk0INYboNoudgr0vrr2wljwgH68VZQXEwk7T/q8EeXQIepnHClHAeq\n\tNYaA==","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=GhQypdrhXyhvhVzF4Xa/xyCqs68rNpQZTASJYYuErR4=;\n\tb=O/DRZmPhNkQgid63HwHq+utQ4wAP5W49K89nm6IQHes9bL5osbR8ljGIarfVo7wdGU\n\tVbC9Hzsune6rtR7Rji0T0hVM4K6tb7WgS+W8JItyLpV3HqUQ/l8UBbGXL4QK16mCRigl\n\tnrSnOTcrvjekCQSeFb2WvHXpbv0F8CACKiexuNf/JVwk478EMKUAAEJy3Io+2Vwb5ld5\n\tkIhEkMC6aRYY1c0ezSd29CexFBG34EsXklPBcau1FNO5e1sSFYhmt8E/vW0KJU+gHKU/\n\tG0ON0ltM/szWBViKu4hP4T8rxghyQl223lT35ODrLJTDBm4YeZrUyyet2nXKYxvQQg+E\n\tBoZg==","X-Gm-Message-State":"AHQUAuYljyRQuklxWrUTNdNFnpKiWHnDpYJYiOGN1A/2xMGGH19XfzRm\n\tjySSUIQ2n7GFxejy2Bm74hjazJCYgF4=","X-Google-Smtp-Source":"AHgI3IYgf73WEXudarxw45lavZeECmMg82jdhgPCYgUpZrQ4jNN9lr/yHsdCPj5Un18u6gHKLEqXxQ==","X-Received":"by 2002:a2e:9056:: with SMTP id\n\tn22mr11637127ljg.132.1551148226995; \n\tMon, 25 Feb 2019 18:30:26 -0800 (PST)","Date":"Tue, 26 Feb 2019 03:30:25 +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":"<20190226023025.GH899@bigcity.dyn.berto.se>","References":"<20190225121037.11415-1-jacopo@jmondi.org>\n\t<20190225121037.11415-2-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-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: v4l2_subdevice:\n\tStore media entity","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:30:28 -0000"}},{"id":885,"web_url":"https://patchwork.libcamera.org/comment/885/","msgid":"<20190226081846.lrxtkyj5xeleokbk@uno.localdomain>","date":"2019-02-26T08:18:46","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: v4l2_subdevice:\n\tStore media entity","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Tue, Feb 26, 2019 at 03:30:25AM +0100, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your patch.\n>\n> On 2019-02-25 13:10:32 +0100, Jacopo Mondi wrote:\n> > Store the media entity backing the V4L2Subdevice and add a deviceName()\n> > method to retrieve the human readable name of the subdevice, which is\n> > created using the name of the associated media entity.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/v4l2_subdevice.h | 5 ++++-\n> >  src/libcamera/v4l2_subdevice.cpp       | 9 ++++++++-\n> >  2 files changed, 12 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> > index 82fa6685ab52..fcfbee5af106 100644\n> > --- a/src/libcamera/include/v4l2_subdevice.h\n> > +++ b/src/libcamera/include/v4l2_subdevice.h\n> > @@ -9,9 +9,10 @@\n> >\n> >  #include <string>\n> >\n> > +#include \"media_object.h\"\n> > +\n> >  namespace libcamera {\n> >\n> > -class MediaEntity;\n> >  struct Rectangle;\n> >\n> >  struct V4L2SubdeviceFormat {\n> > @@ -32,6 +33,7 @@ public:\n> >  \tvoid close();\n> >\n> >  \tstd::string deviceNode() const { return deviceNode_; }\n> > +\tstd::string deviceName() const { return entity_->name(); }\n> >\n> >  \tint setCrop(unsigned int pad, Rectangle *rect);\n> >  \tint setCompose(unsigned int pad, Rectangle *rect);\n> > @@ -43,6 +45,7 @@ private:\n> >  \tint setSelection(unsigned int pad, unsigned int target,\n> >  \t\t\t Rectangle *rect);\n> >\n> > +\tconst MediaEntity *entity_;\n> >  \tstd::string deviceNode_;\n> >  \tint fd_;\n> >  };\n> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > index b436f73cc75f..ebf87f0124cb 100644\n> > --- a/src/libcamera/v4l2_subdevice.cpp\n> > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > @@ -88,7 +88,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n> >   * path\n> >   */\n> >  V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)\n> > -\t: deviceNode_(entity->deviceNode()), fd_(-1)\n> > +\t: entity_(entity), deviceNode_(entity->deviceNode()), fd_(-1)\n>\n> This looks odd. Can't you remove the deviceNode_ member of\n> V4L2SubdeviceFormat and use the same schema to retrieve it as\n> deviceName?\n>\n>     std::string deviceNode() const { return entity_->deviceNode(); }\n>     std::string deviceName() const { return entity_->name(); }\n\ndeviceNode is used in several places, I considered it was better to\nstore it to avoid going through accessing the entity_.\n\nI'm sure the advantage is not that significant, so if you prefer so,\nI'll change it.\n\nThanks\n  j\n\n>\n> >  {\n> >  }\n> >\n> > @@ -147,6 +147,13 @@ void V4L2Subdevice::close()\n> >   * \\return The subdevice's device node system path\n> >   */\n> >\n> > +/**\n> > + * \\fn V4L2Subdevice::deviceName()\n> > + * \\brief Retrieve the name of the media entity associated with the subdevice\n> > + *\n> > + * \\return The name of the media entity the subdevice is associated to\n> > + */\n> > +\n> >  /**\n> >   * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n> >   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\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\n>\n> --\n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A7D9600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Feb 2019 09:18:18 +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 relay11.mail.gandi.net (Postfix) with ESMTPSA id 7F8EC10000B;\n\tTue, 26 Feb 2019 08:18:17 +0000 (UTC)"],"Date":"Tue, 26 Feb 2019 09:18:46 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190226081846.lrxtkyj5xeleokbk@uno.localdomain>","References":"<20190225121037.11415-1-jacopo@jmondi.org>\n\t<20190225121037.11415-2-jacopo@jmondi.org>\n\t<20190226023025.GH899@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"m7jptgkzpdqjmt3h\"","Content-Disposition":"inline","In-Reply-To":"<20190226023025.GH899@bigcity.dyn.berto.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: v4l2_subdevice:\n\tStore media entity","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 08:18:18 -0000"}}]