[{"id":13095,"web_url":"https://patchwork.libcamera.org/comment/13095/","msgid":"<20201008031746.GU3937@pendragon.ideasonboard.com>","date":"2020-10-08T03:17:46","subject":"Re: [libcamera-devel] [RFC 0/2] android: Introduce CameraWorker","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Tue, Oct 06, 2020 at 06:06:35PM +0200, Jacopo Mondi wrote:\n> This two small patches, sent as RFC mostly for comments on the design,\n> implement a worker in the libcamera HAL that is used to handle synchronization\n> fences before queueing a Request to the libcamera::Camera.\n> \n> The camera framework provides, for each buffer part of a capture request\n> an acquisition fence the camera HAL is supposed to wait on before using\n> the buffer. The wait procedure cannot be performed in the Camera HAL thread, as\n> the HAL runs in the global CameraManager thread.\n\nAll the operations exposed by the HAL to the camera service are run in\nthe camera service thread, not the libcamera CameraManager.\n\n> As fences are handled through a simple poll, it would be possible to install\n> a Notifier for each fence and handle their completion through a Signal in the\n> CameraDevice. Although this would make the class over-complicated.\n> \n> Introducing a worker that synchronously waits on fences using its own thread\n> is a cleaner design a provides a cleaner interface for the CameraDevice.\n> \n> The waitFence() function implementes the same mechanism as the libdrm provided\n> sync_wait() function without introducing an explicit dependency in libcamera.\n> \n> \n> Jacopo Mondi (2):\n>   android: camera_worker: Introduce CameraWorker\n>   android: camera_device: Queue request to Worker\n> \n>  src/android/camera_device.cpp | 21 ++++------\n>  src/android/camera_device.h   |  3 ++\n>  src/android/camera_worker.cpp | 67 +++++++++++++++++++++++++++++++\n>  src/android/camera_worker.h   | 75 +++++++++++++++++++++++++++++++++++\n>  src/android/meson.build       |  1 +\n>  5 files changed, 154 insertions(+), 13 deletions(-)\n>  create mode 100644 src/android/camera_worker.cpp\n>  create mode 100644 src/android/camera_worker.h","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 41619BEEE0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Oct 2020 03:18:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D611E60393;\n\tThu,  8 Oct 2020 05:18:30 +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 2550B60363\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Oct 2020 05:18:29 +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 930A859E;\n\tThu,  8 Oct 2020 05:18:28 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qvKLfUHl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602127108;\n\tbh=fWONcYGwZVAy0NFSYOuHusS/qI6HLLTg5R9taYaT9kE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=qvKLfUHlTl42E2S73eRNs8D4wPJLdGGC37kcTplm9A8r77sLi4oB8y8UJi4CxHu2C\n\tZX0X3jnJWeuIsX4GbjfHf3VpJyLM+gr6Cl2+89dmKrcv8mE4Ed0+WPjC6oV9dReWpI\n\tGiFMJy2ZrHm+7mDhtTJuCHXdJBk+O6E+MlQ1EqC0=","Date":"Thu, 8 Oct 2020 06:17:46 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20201008031746.GU3937@pendragon.ideasonboard.com>","References":"<20201006160637.29841-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201006160637.29841-1-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [RFC 0/2] android: Introduce CameraWorker","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13099,"web_url":"https://patchwork.libcamera.org/comment/13099/","msgid":"<20201008082404.uob5zt5fz4vhe3ot@uno.localdomain>","date":"2020-10-08T08:24:04","subject":"Re: [libcamera-devel] [RFC 0/2] android: Introduce CameraWorker","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Oct 08, 2020 at 06:17:46AM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> On Tue, Oct 06, 2020 at 06:06:35PM +0200, Jacopo Mondi wrote:\n> > This two small patches, sent as RFC mostly for comments on the design,\n> > implement a worker in the libcamera HAL that is used to handle synchronization\n> > fences before queueing a Request to the libcamera::Camera.\n> >\n> > The camera framework provides, for each buffer part of a capture request\n> > an acquisition fence the camera HAL is supposed to wait on before using\n> > the buffer. The wait procedure cannot be performed in the Camera HAL thread, as\n> > the HAL runs in the global CameraManager thread.\n>\n> All the operations exposed by the HAL to the camera service are run in\n> the camera service thread, not the libcamera CameraManager.\n>\n\nCorrect, I mixed up the two (in a reply to Niklas too)\n\n> > As fences are handled through a simple poll, it would be possible to install\n> > a Notifier for each fence and handle their completion through a Signal in the\n> > CameraDevice. Although this would make the class over-complicated.\n> >\n> > Introducing a worker that synchronously waits on fences using its own thread\n> > is a cleaner design a provides a cleaner interface for the CameraDevice.\n> >\n> > The waitFence() function implementes the same mechanism as the libdrm provided\n> > sync_wait() function without introducing an explicit dependency in libcamera.\n> >\n> >\n> > Jacopo Mondi (2):\n> >   android: camera_worker: Introduce CameraWorker\n> >   android: camera_device: Queue request to Worker\n> >\n> >  src/android/camera_device.cpp | 21 ++++------\n> >  src/android/camera_device.h   |  3 ++\n> >  src/android/camera_worker.cpp | 67 +++++++++++++++++++++++++++++++\n> >  src/android/camera_worker.h   | 75 +++++++++++++++++++++++++++++++++++\n> >  src/android/meson.build       |  1 +\n> >  5 files changed, 154 insertions(+), 13 deletions(-)\n> >  create mode 100644 src/android/camera_worker.cpp\n> >  create mode 100644 src/android/camera_worker.h\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 69C18BEEE0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Oct 2020 08:20:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 464C7605BD;\n\tThu,  8 Oct 2020 10:20:06 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 643CE60358\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Oct 2020 10:20:05 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id A67DD240011;\n\tThu,  8 Oct 2020 08:20:04 +0000 (UTC)"],"Date":"Thu, 8 Oct 2020 10:24:04 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20201008082404.uob5zt5fz4vhe3ot@uno.localdomain>","References":"<20201006160637.29841-1-jacopo@jmondi.org>\n\t<20201008031746.GU3937@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201008031746.GU3937@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC 0/2] android: Introduce CameraWorker","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]