[{"id":18564,"web_url":"https://patchwork.libcamera.org/comment/18564/","msgid":"<1e0905fe-5b32-ae5c-ae62-5aac3e541361@ideasonboard.com>","date":"2021-08-05T07:42:15","subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn 8/4/21 6:13 PM, Laurent Pinchart wrote:\n> Use the KMSSink class to display the viewfinder stream, if any, through\n> DRM/KMS. The output connector is selected through the new -D/--display\n> argument.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n> Changes since v2:\n>\n> - Add compile guard around option check\n>\n> Changes since v1:\n>\n> - Validate display option in CamApp::init()\n> ---\n>   src/cam/camera_session.cpp | 30 ++++++++++++++++++++++++++++++\n>   src/cam/main.cpp           |  6 ++++++\n>   src/cam/main.h             |  1 +\n>   3 files changed, 37 insertions(+)\n>\n> diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\n> index f34a6ed55ad7..60d640f2b15c 100644\n> --- a/src/cam/camera_session.cpp\n> +++ b/src/cam/camera_session.cpp\n> @@ -16,6 +16,9 @@\n>   #include \"camera_session.h\"\n>   #include \"event_loop.h\"\n>   #include \"file_sink.h\"\n> +#ifdef HAVE_KMS\n> +#include \"kms_sink.h\"\n> +#endif\n>   #include \"main.h\"\n>   #include \"stream_options.h\"\n>   \n> @@ -66,6 +69,28 @@ CameraSession::CameraSession(CameraManager *cm,\n>   \n>   \tbool strictFormats = options_.isSet(OptStrictFormats);\n>   \n> +#ifdef HAVE_KMS\n> +\tif (options_.isSet(OptDisplay)) {\n> +\t\tif (options_.isSet(OptFile)) {\n> +\t\t\tstd::cerr << \"--display and --file options are mutually exclusive\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn;\n> +\t\t}\n> +\n> +\t\tif (roles.size() != 1) {\n> +\t\t\tstd::cerr << \"Display doesn't support multiple streams\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn;\n> +\t\t}\n> +\n> +\t\tif (roles[0] != StreamRole::Viewfinder) {\n> +\t\t\tstd::cerr << \"Display requires a viewfinder stream\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn;\n> +\t\t}\n> +\t}\n> +#endif\n> +\n>   \tswitch (config->validate()) {\n>   \tcase CameraConfiguration::Valid:\n>   \t\tbreak;\n> @@ -161,6 +186,11 @@ int CameraSession::start()\n>   \n>   \tcamera_->requestCompleted.connect(this, &CameraSession::requestComplete);\n>   \n> +#ifdef HAVE_KMS\n> +\tif (options_.isSet(OptDisplay))\n> +\t\tsink_ = std::make_unique<KMSSink>(options_[OptDisplay].toString());\n> +#endif\n> +\n>   \tif (options_.isSet(OptFile)) {\n>   \t\tif (!options_[OptFile].toString().empty())\n>   \t\t\tsink_ = std::make_unique<FileSink>(options_[OptFile]);\n> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> index 34cbc3229563..c7f664b903e0 100644\n> --- a/src/cam/main.cpp\n> +++ b/src/cam/main.cpp\n> @@ -132,6 +132,12 @@ int CamApp::parseOptions(int argc, char *argv[])\n>   \t\t\t \"Capture until interrupted by user or until <count> frames captured\",\n>   \t\t\t \"capture\", ArgumentOptional, \"count\", false,\n>   \t\t\t OptCamera);\n> +#ifdef HAVE_KMS\n> +\tparser.addOption(OptDisplay, OptionString,\n> +\t\t\t \"Display viewfinder through DRM/KMS on specified connector\",\n> +\t\t\t \"display\", ArgumentOptional, \"connector\", false,\n> +\t\t\t OptCamera);\n> +#endif\n>   \tparser.addOption(OptFile, OptionString,\n>   \t\t\t \"Write captured frames to disk\\n\"\n>   \t\t\t \"If the file name ends with a '/', it sets the directory in which\\n\"\n> diff --git a/src/cam/main.h b/src/cam/main.h\n> index d22451f59817..1c2fab763698 100644\n> --- a/src/cam/main.h\n> +++ b/src/cam/main.h\n> @@ -10,6 +10,7 @@\n>   enum {\n>   \tOptCamera = 'c',\n>   \tOptCapture = 'C',\n> +\tOptDisplay = 'D',\n>   \tOptFile = 'F',\n>   \tOptHelp = 'h',\n>   \tOptInfo = 'I',","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 16562C3232\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Aug 2021 07:42:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE1C76880D;\n\tThu,  5 Aug 2021 09:42:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DDE5A687CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Aug 2021 09:42:20 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.40])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AC84B51D;\n\tThu,  5 Aug 2021 09:42:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OWlLV+Qb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628149340;\n\tbh=NLOQDqcAGZ9wZX7hJaz6/Mp4tZAnuxDPmcaSFQ2PSoY=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=OWlLV+QbhMvf2na/fr9+ryVZ4t7YIpnXH+o6j0dKc98jFhfjlvGZlE2Xy6Qll4nAp\n\tQq+tz59BNlSs/Y1S5slerXKb9rcing87o6TCrY+d3fAadZnE1SpJ0uRZkCHUPnGegq\n\t24ocrrYWoTFz1/RvrFPsHwr4hZTSG2FZ9lLX4aJY=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210804124314.8044-1-laurent.pinchart@ideasonboard.com>\n\t<20210804124314.8044-9-laurent.pinchart@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<1e0905fe-5b32-ae5c-ae62-5aac3e541361@ideasonboard.com>","Date":"Thu, 5 Aug 2021 13:12:15 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210804124314.8044-9-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18573,"web_url":"https://patchwork.libcamera.org/comment/18573/","msgid":"<d05d14cf-9d24-b5ab-75f4-1669f0abd0ac@ideasonboard.com>","date":"2021-08-05T12:48:31","subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 04/08/2021 13:43, Laurent Pinchart wrote:\n> Use the KMSSink class to display the viewfinder stream, if any, through\n> DRM/KMS. The output connector is selected through the new -D/--display\n> argument.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nI'm weary of one small issue with this patch.\n\ncam allocates buffers and requests based on the size from libcamera\nsuggested by libcamera, while this series introduces a requirement for a\nminimum of at least 3 requests.\n\nI 'think' that will be handled better by Nicolas' series where we can\nhandle allocations with the applciation having more control of setting\nsome minumums.\n\nIs there anything needed to be handled here? I suspect internally\nlibcamera is always returning a buffer count of 4 or something most\nlikely at the moment - so its' proabbly a non-issue until Nicolas'\nseries starts to introduce MinimumRequests ...\n\nSo ... my concerns are likely to be both caused and handled by an out of\ntree series and thus...\n\n\n\n\n> ---\n> Changes since v2:\n> \n> - Add compile guard around option check\n> \n> Changes since v1:\n> \n> - Validate display option in CamApp::init()\n> ---\n>  src/cam/camera_session.cpp | 30 ++++++++++++++++++++++++++++++\n>  src/cam/main.cpp           |  6 ++++++\n>  src/cam/main.h             |  1 +\n>  3 files changed, 37 insertions(+)\n> \n> diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\n> index f34a6ed55ad7..60d640f2b15c 100644\n> --- a/src/cam/camera_session.cpp\n> +++ b/src/cam/camera_session.cpp\n> @@ -16,6 +16,9 @@\n>  #include \"camera_session.h\"\n>  #include \"event_loop.h\"\n>  #include \"file_sink.h\"\n> +#ifdef HAVE_KMS\n> +#include \"kms_sink.h\"\n> +#endif\n>  #include \"main.h\"\n>  #include \"stream_options.h\"\n>  \n> @@ -66,6 +69,28 @@ CameraSession::CameraSession(CameraManager *cm,\n>  \n>  \tbool strictFormats = options_.isSet(OptStrictFormats);\n>  \n> +#ifdef HAVE_KMS\n> +\tif (options_.isSet(OptDisplay)) {\n> +\t\tif (options_.isSet(OptFile)) {\n> +\t\t\tstd::cerr << \"--display and --file options are mutually exclusive\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn;\n> +\t\t}\n> +\n> +\t\tif (roles.size() != 1) {\n> +\t\t\tstd::cerr << \"Display doesn't support multiple streams\"\n> +\t\t\t\t  << std::endl;\n\nDo you also protect/prevent multiple cameras trying to display at the\nsame time?\n\n(now that we have multi-cam support in cam...?)\n\nIf that's going to be OK, or when handled if it's a problem:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> +\t\t\treturn;\n> +\t\t}\n> +\n> +\t\tif (roles[0] != StreamRole::Viewfinder) {\n> +\t\t\tstd::cerr << \"Display requires a viewfinder stream\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn;\n> +\t\t}\n> +\t}\n> +#endif\n> +\n>  \tswitch (config->validate()) {\n>  \tcase CameraConfiguration::Valid:\n>  \t\tbreak;\n> @@ -161,6 +186,11 @@ int CameraSession::start()\n>  \n>  \tcamera_->requestCompleted.connect(this, &CameraSession::requestComplete);\n>  \n> +#ifdef HAVE_KMS\n> +\tif (options_.isSet(OptDisplay))\n> +\t\tsink_ = std::make_unique<KMSSink>(options_[OptDisplay].toString());\n> +#endif\n> +\n>  \tif (options_.isSet(OptFile)) {\n>  \t\tif (!options_[OptFile].toString().empty())\n>  \t\t\tsink_ = std::make_unique<FileSink>(options_[OptFile]);\n> diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> index 34cbc3229563..c7f664b903e0 100644\n> --- a/src/cam/main.cpp\n> +++ b/src/cam/main.cpp\n> @@ -132,6 +132,12 @@ int CamApp::parseOptions(int argc, char *argv[])\n>  \t\t\t \"Capture until interrupted by user or until <count> frames captured\",\n>  \t\t\t \"capture\", ArgumentOptional, \"count\", false,\n>  \t\t\t OptCamera);\n> +#ifdef HAVE_KMS\n> +\tparser.addOption(OptDisplay, OptionString,\n> +\t\t\t \"Display viewfinder through DRM/KMS on specified connector\",\n> +\t\t\t \"display\", ArgumentOptional, \"connector\", false,\n> +\t\t\t OptCamera);\n> +#endif\n>  \tparser.addOption(OptFile, OptionString,\n>  \t\t\t \"Write captured frames to disk\\n\"\n>  \t\t\t \"If the file name ends with a '/', it sets the directory in which\\n\"\n> diff --git a/src/cam/main.h b/src/cam/main.h\n> index d22451f59817..1c2fab763698 100644\n> --- a/src/cam/main.h\n> +++ b/src/cam/main.h\n> @@ -10,6 +10,7 @@\n>  enum {\n>  \tOptCamera = 'c',\n>  \tOptCapture = 'C',\n> +\tOptDisplay = 'D',\n>  \tOptFile = 'F',\n>  \tOptHelp = 'h',\n>  \tOptInfo = 'I',\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 68E37C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Aug 2021 12:48:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CED8D6881B;\n\tThu,  5 Aug 2021 14:48:35 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A5506026D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Aug 2021 14:48:34 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F3B2151D;\n\tThu,  5 Aug 2021 14:48:33 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"R0GqhBbv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628167714;\n\tbh=LW/E9MevLOhhpy1q3VD3H37P+RPrzvCZLjag2Zmry98=;\n\th=To:References:From:Subject:Date:In-Reply-To:From;\n\tb=R0GqhBbvfkgXcWo31vD+fCxEL/HEI23pRjVthP/bOm4j9cDX8jU8v+ezD2tF5EvFr\n\txjapUGlPYiBpb2D+4NuMmFJBUd7Jt0XFbSEvQRS2itUO1C4FpCIDZ15bSZI3IHygT3\n\tQ83g9oulGq0IqeuMLNQlJGdYm1PXbr3WmU1gdOPg=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210804124314.8044-1-laurent.pinchart@ideasonboard.com>\n\t<20210804124314.8044-9-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<d05d14cf-9d24-b5ab-75f4-1669f0abd0ac@ideasonboard.com>","Date":"Thu, 5 Aug 2021 13:48:31 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210804124314.8044-9-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18575,"web_url":"https://patchwork.libcamera.org/comment/18575/","msgid":"<YQvj176KtXskd8GX@pendragon.ideasonboard.com>","date":"2021-08-05T13:12:55","subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Thu, Aug 05, 2021 at 01:48:31PM +0100, Kieran Bingham wrote:\n> On 04/08/2021 13:43, Laurent Pinchart wrote:\n> > Use the KMSSink class to display the viewfinder stream, if any, through\n> > DRM/KMS. The output connector is selected through the new -D/--display\n> > argument.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> I'm weary of one small issue with this patch.\n> \n> cam allocates buffers and requests based on the size from libcamera\n> suggested by libcamera, while this series introduces a requirement for a\n> minimum of at least 3 requests.\n> \n> I 'think' that will be handled better by Nicolas' series where we can\n> handle allocations with the applciation having more control of setting\n> some minumums.\n> \n> Is there anything needed to be handled here? I suspect internally\n> libcamera is always returning a buffer count of 4 or something most\n> likely at the moment - so its' proabbly a non-issue until Nicolas'\n> series starts to introduce MinimumRequests ...\n> \n> So ... my concerns are likely to be both caused and handled by an out of\n> tree series and thus...\n\nYou're right, we should ensure a minimum number of requests, and you're\nalso right that we don't need it yet :-) There's ongoing discussion on\nthis topic in Nícolas's series.\n\n> > ---\n> > Changes since v2:\n> > \n> > - Add compile guard around option check\n> > \n> > Changes since v1:\n> > \n> > - Validate display option in CamApp::init()\n> > ---\n> >  src/cam/camera_session.cpp | 30 ++++++++++++++++++++++++++++++\n> >  src/cam/main.cpp           |  6 ++++++\n> >  src/cam/main.h             |  1 +\n> >  3 files changed, 37 insertions(+)\n> > \n> > diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\n> > index f34a6ed55ad7..60d640f2b15c 100644\n> > --- a/src/cam/camera_session.cpp\n> > +++ b/src/cam/camera_session.cpp\n> > @@ -16,6 +16,9 @@\n> >  #include \"camera_session.h\"\n> >  #include \"event_loop.h\"\n> >  #include \"file_sink.h\"\n> > +#ifdef HAVE_KMS\n> > +#include \"kms_sink.h\"\n> > +#endif\n> >  #include \"main.h\"\n> >  #include \"stream_options.h\"\n> >  \n> > @@ -66,6 +69,28 @@ CameraSession::CameraSession(CameraManager *cm,\n> >  \n> >  \tbool strictFormats = options_.isSet(OptStrictFormats);\n> >  \n> > +#ifdef HAVE_KMS\n> > +\tif (options_.isSet(OptDisplay)) {\n> > +\t\tif (options_.isSet(OptFile)) {\n> > +\t\t\tstd::cerr << \"--display and --file options are mutually exclusive\"\n> > +\t\t\t\t  << std::endl;\n> > +\t\t\treturn;\n> > +\t\t}\n> > +\n> > +\t\tif (roles.size() != 1) {\n> > +\t\t\tstd::cerr << \"Display doesn't support multiple streams\"\n> > +\t\t\t\t  << std::endl;\n> \n> Do you also protect/prevent multiple cameras trying to display at the\n> same time?\n> \n> (now that we have multi-cam support in cam...?)\n\nIt's prevented by the fact that it will fail creating the second KMS\nsink. In order to display multiple cameras this code will need quite a\nbit of rework. I'd be happy to review patches ;-)\n\n> If that's going to be OK, or when handled if it's a problem:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > +\t\t\treturn;\n> > +\t\t}\n> > +\n> > +\t\tif (roles[0] != StreamRole::Viewfinder) {\n> > +\t\t\tstd::cerr << \"Display requires a viewfinder stream\"\n> > +\t\t\t\t  << std::endl;\n> > +\t\t\treturn;\n> > +\t\t}\n> > +\t}\n> > +#endif\n> > +\n> >  \tswitch (config->validate()) {\n> >  \tcase CameraConfiguration::Valid:\n> >  \t\tbreak;\n> > @@ -161,6 +186,11 @@ int CameraSession::start()\n> >  \n> >  \tcamera_->requestCompleted.connect(this, &CameraSession::requestComplete);\n> >  \n> > +#ifdef HAVE_KMS\n> > +\tif (options_.isSet(OptDisplay))\n> > +\t\tsink_ = std::make_unique<KMSSink>(options_[OptDisplay].toString());\n> > +#endif\n> > +\n> >  \tif (options_.isSet(OptFile)) {\n> >  \t\tif (!options_[OptFile].toString().empty())\n> >  \t\t\tsink_ = std::make_unique<FileSink>(options_[OptFile]);\n> > diff --git a/src/cam/main.cpp b/src/cam/main.cpp\n> > index 34cbc3229563..c7f664b903e0 100644\n> > --- a/src/cam/main.cpp\n> > +++ b/src/cam/main.cpp\n> > @@ -132,6 +132,12 @@ int CamApp::parseOptions(int argc, char *argv[])\n> >  \t\t\t \"Capture until interrupted by user or until <count> frames captured\",\n> >  \t\t\t \"capture\", ArgumentOptional, \"count\", false,\n> >  \t\t\t OptCamera);\n> > +#ifdef HAVE_KMS\n> > +\tparser.addOption(OptDisplay, OptionString,\n> > +\t\t\t \"Display viewfinder through DRM/KMS on specified connector\",\n> > +\t\t\t \"display\", ArgumentOptional, \"connector\", false,\n> > +\t\t\t OptCamera);\n> > +#endif\n> >  \tparser.addOption(OptFile, OptionString,\n> >  \t\t\t \"Write captured frames to disk\\n\"\n> >  \t\t\t \"If the file name ends with a '/', it sets the directory in which\\n\"\n> > diff --git a/src/cam/main.h b/src/cam/main.h\n> > index d22451f59817..1c2fab763698 100644\n> > --- a/src/cam/main.h\n> > +++ b/src/cam/main.h\n> > @@ -10,6 +10,7 @@\n> >  enum {\n> >  \tOptCamera = 'c',\n> >  \tOptCapture = 'C',\n> > +\tOptDisplay = 'D',\n> >  \tOptFile = 'F',\n> >  \tOptHelp = 'h',\n> >  \tOptInfo = 'I',","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2489EC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Aug 2021 13:13:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8FDD668811;\n\tThu,  5 Aug 2021 15:13:10 +0200 (CEST)","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 848626026D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Aug 2021 15:13:08 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 10D0651D;\n\tThu,  5 Aug 2021 15:13:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DgkJxhLn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628169188;\n\tbh=4COwl3+X18UpMldI0fQpCdlBfyiJ36k1b76/60Ji2/A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DgkJxhLnCBUv5bCnQlzkjDp2MM0XMY8NYTXSFWkISMYQ3dF/EvC4r+Te0HkT0gJBz\n\tKcYuzsygTBNoL4BUtmPnhoMtlPOUfg/EpyP/Z+xIEq6MzgYTGrFZsueEuYyH9HKFDN\n\tbGVTCKJIMr0Pdddk76mapABm9REtFXAK7W5yCBsg=","Date":"Thu, 5 Aug 2021 16:12:55 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YQvj176KtXskd8GX@pendragon.ideasonboard.com>","References":"<20210804124314.8044-1-laurent.pinchart@ideasonboard.com>\n\t<20210804124314.8044-9-laurent.pinchart@ideasonboard.com>\n\t<d05d14cf-9d24-b5ab-75f4-1669f0abd0ac@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<d05d14cf-9d24-b5ab-75f4-1669f0abd0ac@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 8/8] cam: Add support for\n\tviewfinder through DRM/KMS","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]