[{"id":113,"web_url":"https://patchwork.libcamera.org/comment/113/","msgid":"<10043315.bbmVOekjAi@avalon>","date":"2018-12-29T00:48:48","subject":"Re: [libcamera-devel] [PATCH 11/12] libcamera: pipe-vimc: add\n\tpipeline handler for vimc","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Sunday, 23 December 2018 01:00:40 EET Niklas Söderlund wrote:\n> Provide a pipeline handler for the virtual vimc driver.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/meson.build   |  1 +\n>  src/libcamera/pipe-vimc.cpp | 92 +++++++++++++++++++++++++++++++++++++\n>  2 files changed, 93 insertions(+)\n>  create mode 100644 src/libcamera/pipe-vimc.cpp\n> \n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 8457e57939b862ed..088c76f72d331784 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -4,6 +4,7 @@ libcamera_sources = files([\n>      'deviceenumerator.cpp',\n>      'log.cpp',\n>      'main.cpp',\n> +    'pipe-vimc.cpp',\n>      'pipelinehandler.cpp',\n>  ])\n> \n> diff --git a/src/libcamera/pipe-vimc.cpp b/src/libcamera/pipe-vimc.cpp\n> new file mode 100644\n> index 0000000000000000..14bb96faece908de\n> --- /dev/null\n> +++ b/src/libcamera/pipe-vimc.cpp\n> @@ -0,0 +1,92 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2018, Google Inc.\n> + *\n> + * pipe-vimc.cpp - Pipeline handler for the vimc device\n> + */\n> +\n> +#include <libcamera/camera.h>\n> +\n> +#include \"deviceenumerator.h\"\n> +#include \"pipelinehandler.h\"\n> +\n> +namespace libcamera {\n> +\n> +class PipeHandlerVimc : public PipelineHandler\n> +{\n> +public:\n> +\tPipeHandlerVimc();\n> +\t~PipeHandlerVimc();\n> +\n> +\tbool match(DeviceEnumerator *enumerator);\n> +\n> +\tunsigned int count();\n> +\tCamera *camera(unsigned int id);\n> +private:\n> +\tDeviceInfo *info_;\n> +\tCamera *camera_;\n> +};\n> +\n> +PipeHandlerVimc::PipeHandlerVimc()\n> +\t: info_(NULL), camera_(NULL)\n> +{\n> +}\n> +\n> +PipeHandlerVimc::~PipeHandlerVimc()\n> +{\n> +\tif (camera_)\n> +\t\tcamera_->put();\n> +\n> +\tif (info_)\n> +\t\tinfo_->release();\n> +}\n> +\n> +unsigned int PipeHandlerVimc::count()\n> +{\n> +\treturn 1;\n> +}\n> +\n> +Camera *PipeHandlerVimc::camera(unsigned int id)\n> +{\n> +\tif (id != 0)\n> +\t\treturn NULL;\n> +\n> +\treturn camera_;\n> +}\n> +\n> +bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)\n> +{\n> +\tDeviceMatch dm(\"vimc\");\n> +\n> +\tdm.add(\"Raw Capture 0\");\n> +\tdm.add(\"Raw Capture 1\");\n> +\tdm.add(\"RGB/YUV Capture\");\n> +\tdm.add(\"Sensor A\");\n> +\tdm.add(\"Sensor B\");\n> +\tdm.add(\"Debayer A\");\n> +\tdm.add(\"Debayer B\");\n> +\tdm.add(\"RGB/YUV Input\");\n> +\tdm.add(\"Scaler\");\n> +\n> +\tinfo_ = enumerator->search(dm);\n> +\n> +\tif (info_) {\n> +\t\tinfo_->acquire();\n> +\n> +\t\t/* NOTE: A more complete Camera implementation could\n> +\t\t * be passed the DeviceInfo(s) it controls here or\n> +\t\t * a reference to the PipelineHandler. Which method\n> +\t\t * that is chosen will depend on how the Camera\n> +\t\t * object is modeled.\n> +\t\t */\n> +\t\tcamera_ = new Camera(\"Dummy VIMC Camera\");\n> +\n> +\t\treturn true;\n> +\t}\n> +\n> +\treturn info_ ? true : false;\n\nWhat if multiple vimc devices exist in the system ? It seems to me that only \nthe first one will be handled.\n\n> +}\n> +\n> +REGISTER_PIPELINE(PipeHandlerVimc);\n> +\n> +} /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@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 68F7960B30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Dec 2018 01:47:52 +0100 (CET)","from avalon.localnet (unknown\n\t[IPv6:2a02:2788:66a:3eb:2624:a446:f4b7:b19d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 07F3DDF;\n\tSat, 29 Dec 2018 01:47:51 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1546044472;\n\tbh=RIICaH83lKx6KSNUa8TZLUSPshe3ZV+DfumiDtkrHJQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TenbVzbC57Ushkk9Zd+xOg6VYXYk9RQ+8/BUB87OQSxD8CaMDyEjHNqmsJAaY4g0V\n\tmH9U8EkH8p/5TorhtR2+V/9QpUWJuczXTT/YVXl42s2IiZVvgKbx2v7g6V/diP1/xB\n\tVMEj7k0Zr7q05wDKrS2SEBKChFblrsc3ICuo61Xg=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 29 Dec 2018 02:48:48 +0200","Message-ID":"<10043315.bbmVOekjAi@avalon>","Organization":"Ideas on Board Oy","In-Reply-To":"<20181222230041.29999-12-niklas.soderlund@ragnatech.se>","References":"<20181222230041.29999-1-niklas.soderlund@ragnatech.se>\n\t<20181222230041.29999-12-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","Content-Type":"text/plain; charset=\"iso-8859-1\"","Subject":"Re: [libcamera-devel] [PATCH 11/12] libcamera: pipe-vimc: add\n\tpipeline handler for vimc","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":"Sat, 29 Dec 2018 00:47:52 -0000"}},{"id":120,"web_url":"https://patchwork.libcamera.org/comment/120/","msgid":"<20181229031012.GF19796@bigcity.dyn.berto.se>","date":"2018-12-29T03:10:13","subject":"Re: [libcamera-devel] [PATCH 11/12] libcamera: pipe-vimc: add\n\tpipeline handler for vimc","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn 2018-12-29 02:48:48 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> Thank you for the patch.\n> \n> On Sunday, 23 December 2018 01:00:40 EET Niklas Söderlund wrote:\n> > Provide a pipeline handler for the virtual vimc driver.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/meson.build   |  1 +\n> >  src/libcamera/pipe-vimc.cpp | 92 +++++++++++++++++++++++++++++++++++++\n> >  2 files changed, 93 insertions(+)\n> >  create mode 100644 src/libcamera/pipe-vimc.cpp\n> > \n> > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> > index 8457e57939b862ed..088c76f72d331784 100644\n> > --- a/src/libcamera/meson.build\n> > +++ b/src/libcamera/meson.build\n> > @@ -4,6 +4,7 @@ libcamera_sources = files([\n> >      'deviceenumerator.cpp',\n> >      'log.cpp',\n> >      'main.cpp',\n> > +    'pipe-vimc.cpp',\n> >      'pipelinehandler.cpp',\n> >  ])\n> > \n> > diff --git a/src/libcamera/pipe-vimc.cpp b/src/libcamera/pipe-vimc.cpp\n> > new file mode 100644\n> > index 0000000000000000..14bb96faece908de\n> > --- /dev/null\n> > +++ b/src/libcamera/pipe-vimc.cpp\n> > @@ -0,0 +1,92 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2018, Google Inc.\n> > + *\n> > + * pipe-vimc.cpp - Pipeline handler for the vimc device\n> > + */\n> > +\n> > +#include <libcamera/camera.h>\n> > +\n> > +#include \"deviceenumerator.h\"\n> > +#include \"pipelinehandler.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +class PipeHandlerVimc : public PipelineHandler\n> > +{\n> > +public:\n> > +\tPipeHandlerVimc();\n> > +\t~PipeHandlerVimc();\n> > +\n> > +\tbool match(DeviceEnumerator *enumerator);\n> > +\n> > +\tunsigned int count();\n> > +\tCamera *camera(unsigned int id);\n> > +private:\n> > +\tDeviceInfo *info_;\n> > +\tCamera *camera_;\n> > +};\n> > +\n> > +PipeHandlerVimc::PipeHandlerVimc()\n> > +\t: info_(NULL), camera_(NULL)\n> > +{\n> > +}\n> > +\n> > +PipeHandlerVimc::~PipeHandlerVimc()\n> > +{\n> > +\tif (camera_)\n> > +\t\tcamera_->put();\n> > +\n> > +\tif (info_)\n> > +\t\tinfo_->release();\n> > +}\n> > +\n> > +unsigned int PipeHandlerVimc::count()\n> > +{\n> > +\treturn 1;\n> > +}\n> > +\n> > +Camera *PipeHandlerVimc::camera(unsigned int id)\n> > +{\n> > +\tif (id != 0)\n> > +\t\treturn NULL;\n> > +\n> > +\treturn camera_;\n> > +}\n> > +\n> > +bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)\n> > +{\n> > +\tDeviceMatch dm(\"vimc\");\n> > +\n> > +\tdm.add(\"Raw Capture 0\");\n> > +\tdm.add(\"Raw Capture 1\");\n> > +\tdm.add(\"RGB/YUV Capture\");\n> > +\tdm.add(\"Sensor A\");\n> > +\tdm.add(\"Sensor B\");\n> > +\tdm.add(\"Debayer A\");\n> > +\tdm.add(\"Debayer B\");\n> > +\tdm.add(\"RGB/YUV Input\");\n> > +\tdm.add(\"Scaler\");\n> > +\n> > +\tinfo_ = enumerator->search(dm);\n> > +\n> > +\tif (info_) {\n> > +\t\tinfo_->acquire();\n> > +\n> > +\t\t/* NOTE: A more complete Camera implementation could\n> > +\t\t * be passed the DeviceInfo(s) it controls here or\n> > +\t\t * a reference to the PipelineHandler. Which method\n> > +\t\t * that is chosen will depend on how the Camera\n> > +\t\t * object is modeled.\n> > +\t\t */\n> > +\t\tcamera_ = new Camera(\"Dummy VIMC Camera\");\n> > +\n> > +\t\treturn true;\n> > +\t}\n> > +\n> > +\treturn info_ ? true : false;\n> \n> What if multiple vimc devices exist in the system ? It seems to me that only \n> the first one will be handled.\n\nOnly one vimc device will be handled by one instance of PipeHandlerVimc.  \nIf there are more then one device two instances of PipeHandlerVimc will \nbe created, see CameraManager::start():\n\n        for (std::string const &handler : handlers) {\n                PipelineHandler *pipe;\n\n                /*  \n                 * Try each pipeline handler until it exhaust\n                 * all pipelines it can provide.\n                 */\n                do {\n                        pipe = PipelineHandlerFactory::create(handler, enumerator_);\n                        if (pipe)\n                                pipes_.push_back(pipe);\n                } while (pipe);\n        }\n> \n> > +}\n> > +\n> > +REGISTER_PIPELINE(PipeHandlerVimc);\n> > +\n> > +} /* namespace libcamera */\n> \n> \n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> \n>","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B5CC60B30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Dec 2018 04:10:15 +0100 (CET)","by mail-lf1-x143.google.com with SMTP id y11so15552806lfj.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Dec 2018 19:10:14 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tw16-v6sm8918530ljw.11.2018.12.28.19.10.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 28 Dec 2018 19:10: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=L+0/Ox+HBlO2cGHXmekeYALGMjvvQHR3wPCw0pVPa4s=;\n\tb=Tp0r0Dc3gKfWrYd9rDjK8TY5y87lYHGGot7vECxYqkffr2s6yQIVbZ62y72g4AVYys\n\tln2OkgTuaTTrPg1dQ9TP+23BpAdpRHMA8l5m2aY5evj+CRCrqDxnV51ajQGC5iWfOFYg\n\tgSdraIeuKPnWJ8B9rUOtGr+0U53BRBCOqcj4LuFx8LFRbB035TYwH1kLAqi07NTaVOtg\n\t13MaInDn05moZdOut2yGlnQt+tlbFYyZCphDD4RgBzV2ltMQ7347Rtlj49zV9h9+5nkB\n\tgleOcmkACyYvBirGEn7jnZHv6Ix0XO4Ix2Io/CgdryOKgQKBt9C6iG48v0ASQe6zSEIz\n\tHzvg==","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=L+0/Ox+HBlO2cGHXmekeYALGMjvvQHR3wPCw0pVPa4s=;\n\tb=C3uOpCfH11eL/inqJ1S7FX0Ee4RdXAxiuWL3pufvr5nb3cMeZAdzTp1z+vFjzYsIXV\n\teUvMvGAWcQ1Bg1exP6F1/2Cszy9KcMrAANLrPWT34cr+CX5tHZ5n3LTOwDNlcwAUjbKl\n\tGkb0kMA0Xs7U848S9D7EZP67g2uMsT8bisxkjNHv8dtsrTMZV8O4/rvrovoEGPF/IuXK\n\tXm7w17rB8H+BOT2uSi5MyMSoyXtfIYiQGRaK9ZOMxXq5IObI8yev8Q3fZqnB6bGZwn7t\n\tLLV6hmd4zDjpoSaY4BGBaY6zhXmNpvHXCY/RY0bLTKhDR4j9EFqdB4SsDBaM8sSSGNtt\n\tpBsg==","X-Gm-Message-State":"AA+aEWbauVTCnc3oAnDKwD8yx6oa8LbQg1mDODGPiPQs/AWAr1KyfrWM\n\t+JMMFeOu7GiIDkuHcoF8w+iTQfo1pq0=","X-Google-Smtp-Source":"AFSGD/W4i99feML6zWJSYS1PRTWAdVanA6o3LzisYUXPnFuct9UQM+0kXWjDJ/l4WWENQ0FV4dH+bw==","X-Received":"by 2002:a19:d8d8:: with SMTP id\n\tr85mr14956340lfi.92.1546053014261; \n\tFri, 28 Dec 2018 19:10:14 -0800 (PST)","Date":"Sat, 29 Dec 2018 04:10:13 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20181229031012.GF19796@bigcity.dyn.berto.se>","References":"<20181222230041.29999-1-niklas.soderlund@ragnatech.se>\n\t<20181222230041.29999-12-niklas.soderlund@ragnatech.se>\n\t<10043315.bbmVOekjAi@avalon>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<10043315.bbmVOekjAi@avalon>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 11/12] libcamera: pipe-vimc: add\n\tpipeline handler for vimc","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":"Sat, 29 Dec 2018 03:10:15 -0000"}}]