[{"id":12098,"web_url":"https://patchwork.libcamera.org/comment/12098/","msgid":"<20200823204317.GE6002@pendragon.ideasonboard.com>","date":"2020-08-23T20:43:17","subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nOn Sun, Aug 23, 2020 at 08:03:52PM +0000, email@uajain.com wrote:\n> On Aug 23, 2020 11:59 PM, Laurent Pinchart wrote:\n> > CameraDevice instances are managed through shared pointers to support\n> > hptplug. No reference is however taken on\n> \n> s/hptplug/hotplug/\n> \n> > the device when opened by the\n> > camera service, which could cause an open device to be deleted if\n> > unplugged, leading to a crash when the device is next accessed.\n> >\n> > Fix this by taking a reference when opening a device, and releasing it\n> > at close time. The reference is stored in the CameraDevice instance\n> > itself, which is more efficient than storing it in a container in the\n> > CameraHalManager as that would require lookup operations.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> > src/android/camera_device.cpp | 12 ++++++++++++\n> > src/android/camera_device.h   |  4 +++-\n> > 2 files changed, 15 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index de6f86f7cb9b..52468be70781 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -459,6 +459,12 @@ int CameraDevice::open(const hw_module_t\n> > *hardwareModule)\n> > camera3Device_.ops = &hal_dev_ops;\n> > camera3Device_.priv = this;\n> >\n> > + /*\n> > + * Hold a reference to ourselves, to protect against deletion if the\n> > + * camera is unplugged before being closed.\n> > + */\n> > + self_ = shared_from_this();\n> > +\n> > return 0;\n> > }\n> >\n> > @@ -468,6 +474,12 @@ void CameraDevice::close()\n> > camera_->release();\n> >\n> > running_ = false;\n> > +\n> > + /*\n> > + * Drop our self reference. From this point the CameraDevice may get\n> > + * deleted at any time.\n> > + */\n> > + self_.reset();\n> > }\n> >\n> > void CameraDevice::setCallbacks(const camera3_callback_ops_t *callbacks)\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 3934f194f1b5..fd991c76b90d 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -44,7 +44,8 @@ struct CameraStream {\n> > Encoder *jpeg;\n> > };\n> >\n> > -class CameraDevice : protected libcamera::Loggable\n> > +class CameraDevice : public std::enable_shared_from_this<CameraDevice>,\n> > +      protected libcamera::Loggable\n> > {\n> > public:\n> > static std::shared_ptr<CameraDevice> create(unsigned int id,\n> > @@ -104,6 +105,7 @@ private:\n> >\n> > unsigned int id_;\n> > camera3_device_t camera3Device_;\n> > + std::shared_ptr<CameraDevice> self_;\n> >\n> > bool running_;\n> > std::shared_ptr<libcamera::Camera> camera_;\n> \n> Is this the patch after testing behaviour of a stream-able camera(probably non-\n> UVC) on CrOS with master? \n\nNo it hasn't been tested. Sorry for not sending a cover letter to\nexplain this. I should also have marked this as RFC.\n\n> I am not sure what this fix really achieves, part of the problem is because of\n> my build/test setup :(. I believe right now, the cros_camera_service exits\n> (\"sledge hammer\") when a ongoing streaming camera is unplugged, hence I am not\n> able to follow if ::Close() is called anywhere in hot unplug path. By that\n> extension, I am not sure if at all we are going to drop the manual ref we take,\n> as per this patch.\n\nThe sledge hammer is triggered in the Chrome OS UVC HAL, in\nCameraHal::OnDeviceRemoved(). The Chrome OS camera service itself\ndoesn't exit or abort explicitly when an open camera is disconnected,\nbut that code path has probably received little testing.\n\nIn order to test this we need to support software format conversion in\nthe HAL to make UVC cameras usable on Chrome OS.","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 6BB60BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 23 Aug 2020 20:43:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D32F56279A;\n\tSun, 23 Aug 2020 22:43:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB8BE6037F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 23 Aug 2020 22:43:40 +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 25B9A279;\n\tSun, 23 Aug 2020 22:43:36 +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=\"iUvPvK/6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598215416;\n\tbh=1ko3RzIO5NsCg8Kgmo66X3VcmaTKw8V9aldoajA81dU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iUvPvK/6S/qdRFUndszWsnfSCwwt3pVbPdQp03NJ5i24mWGzlvySneYYhzAa0eZVt\n\tCJX1kEwQavvcLpor7OgzC8WIelZOJZND5QB/xQ9ARutvONyW/B/SunrDQXBSJR/3nX\n\tlOXLpV62rW7PR1wYGHDMfe6TIQMhMpz5i8zv7SSM=","Date":"Sun, 23 Aug 2020 23:43:17 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"email@uajain.com","Message-ID":"<20200823204317.GE6002@pendragon.ideasonboard.com>","References":"<20200823182900.18247-1-laurent.pinchart@ideasonboard.com>\n\t<773ac01d-ae1d-446c-864d-d7fb446ec81f@email.android.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<773ac01d-ae1d-446c-864d-d7fb446ec81f@email.android.com>","Subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","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":12119,"web_url":"https://patchwork.libcamera.org/comment/12119/","msgid":"<0b994f11-0a94-bdc4-ed68-ab6f93b7470c@ideasonboard.com>","date":"2020-08-24T10:39:00","subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 23/08/2020 21:43, Laurent Pinchart wrote:\n> Hi Umang,\n> \n> On Sun, Aug 23, 2020 at 08:03:52PM +0000, email@uajain.com wrote:\n>> On Aug 23, 2020 11:59 PM, Laurent Pinchart wrote:\n>>> CameraDevice instances are managed through shared pointers to support\n>>> hptplug. No reference is however taken on\n>>\n>> s/hptplug/hotplug/\n>>\n>>> the device when opened by the\n>>> camera service, which could cause an open device to be deleted if\n>>> unplugged, leading to a crash when the device is next accessed.\n>>>\n>>> Fix this by taking a reference when opening a device, and releasing it\n>>> at close time. The reference is stored in the CameraDevice instance\n>>> itself, which is more efficient than storing it in a container in the\n>>> CameraHalManager as that would require lookup operations.\n>>>\n>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>> ---\n>>> src/android/camera_device.cpp | 12 ++++++++++++\n>>> src/android/camera_device.h   |  4 +++-\n>>> 2 files changed, 15 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n>>> index de6f86f7cb9b..52468be70781 100644\n>>> --- a/src/android/camera_device.cpp\n>>> +++ b/src/android/camera_device.cpp\n>>> @@ -459,6 +459,12 @@ int CameraDevice::open(const hw_module_t\n>>> *hardwareModule)\n>>> camera3Device_.ops = &hal_dev_ops;\n>>> camera3Device_.priv = this;\n>>>\n>>> + /*\n>>> + * Hold a reference to ourselves, to protect against deletion if the\n>>> + * camera is unplugged before being closed.\n>>> + */\n>>> + self_ = shared_from_this();\n>>> +\n>>> return 0;\n>>> }\n>>>\n>>> @@ -468,6 +474,12 @@ void CameraDevice::close()\n>>> camera_->release();\n>>>\n>>> running_ = false;\n>>> +\n>>> + /*\n>>> + * Drop our self reference. From this point the CameraDevice may get\n>>> + * deleted at any time.\n>>> + */\n>>> + self_.reset();\n>>> }\n\nOn initial glances, that sounds like a neat trick!, as long as the\nopen/close calls are symmetrical (or rather unique).\n\n>>>\n>>> void CameraDevice::setCallbacks(const camera3_callback_ops_t *callbacks)\n>>> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n>>> index 3934f194f1b5..fd991c76b90d 100644\n>>> --- a/src/android/camera_device.h\n>>> +++ b/src/android/camera_device.h\n>>> @@ -44,7 +44,8 @@ struct CameraStream {\n>>> Encoder *jpeg;\n>>> };\n>>>\n>>> -class CameraDevice : protected libcamera::Loggable\n>>> +class CameraDevice : public std::enable_shared_from_this<CameraDevice>,\n>>> +      protected libcamera::Loggable\n>>> {\n>>> public:\n>>> static std::shared_ptr<CameraDevice> create(unsigned int id,\n>>> @@ -104,6 +105,7 @@ private:\n>>>\n>>> unsigned int id_;\n>>> camera3_device_t camera3Device_;\n>>> + std::shared_ptr<CameraDevice> self_;\n>>>\n>>> bool running_;\n>>> std::shared_ptr<libcamera::Camera> camera_;\n>>\n>> Is this the patch after testing behaviour of a stream-able camera(probably non-\n>> UVC) on CrOS with master? \n> \n> No it hasn't been tested. Sorry for not sending a cover letter to\n> explain this. I should also have marked this as RFC.\n> \n>> I am not sure what this fix really achieves, part of the problem is because of\n>> my build/test setup :(. I believe right now, the cros_camera_service exits\n>> (\"sledge hammer\") when a ongoing streaming camera is unplugged, hence I am not\n>> able to follow if ::Close() is called anywhere in hot unplug path. By that\n>> extension, I am not sure if at all we are going to drop the manual ref we take,\n>> as per this patch.\n> \n> The sledge hammer is triggered in the Chrome OS UVC HAL, in\n> CameraHal::OnDeviceRemoved(). The Chrome OS camera service itself\n> doesn't exit or abort explicitly when an open camera is disconnected,\n> but that code path has probably received little testing.\n> \n> In order to test this we need to support software format conversion in\n> the HAL to make UVC cameras usable on Chrome OS.\n\nI still wonder if we can quickly 'fake' this by creating a mapping for\nthe YUV or MJPEG formats on a camera to the NV12 format used by\nAndroidHAL - the image wouldn't be visible, but as long as the camera\nonly writes smaller buffers (hence thinking the MJPEG might be better)\nit could be a means to testing the hotplug functionality.","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 B5501BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Aug 2020 10:39:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D28962849;\n\tMon, 24 Aug 2020 12:39:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EC1661ED9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Aug 2020 12:39:13 +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 AB7C0279;\n\tMon, 24 Aug 2020 12:39:02 +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=\"dU9BLgT8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598265542;\n\tbh=jir5cKdOiykh1AWU+UyaHv/Qopm7qDYW4JAEBCDpa58=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=dU9BLgT82CiGuLf5xY4cd0fW+g6qF+0Vl4eAcWKjWFd1y/WIg0KBdNlLZb7TaSieZ\n\tBgPFsWHY40+sKVjL+dCZb5cLJ8nihwoIrJ1izRLnOna3FtH1FM82oK3isA393nNg3K\n\ta+IllXFs7t7PLgCgmzoXToJCrf/aYOQDRSBUdZ44=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, email@uajain.com","References":"<20200823182900.18247-1-laurent.pinchart@ideasonboard.com>\n\t<773ac01d-ae1d-446c-864d-d7fb446ec81f@email.android.com>\n\t<20200823204317.GE6002@pendragon.ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6h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7rRLsGnM15B5PjLJjh1f2ULYkv8s4SnDwMZ/kE04\n\t/UqCMK/KnX8pwXEMCjz0h6qWNpGwJ0/tYIgQJZh6bqkvBrDogAvuhf60Sogw+mH8b+PBlx1L\n\toeTK396wc+4c3BfiC6pNtUS5GpsPMMjYMk7kVvEAEQEAAYkCPAQYAQoAJgIbDBYhBJAt15g/\n\tvSj943LUeqEeRnIQpGH9BQJdizzIBQkLSKZiAAoJEKEeRnIQpGH9eYgQAJpjaWNgqNOnMTmD\n\tMJggbwjIotypzIXfhHNCeTkG7+qCDlSaBPclcPGYrTwCt0YWPU2TgGgJrVhYT20ierN8LUvj\n\t6qOPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz\n\tPZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp\n\tECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<0b994f11-0a94-bdc4-ed68-ab6f93b7470c@ideasonboard.com>","Date":"Mon, 24 Aug 2020 11:39:00 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200823204317.GE6002@pendragon.ideasonboard.com>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","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>","Reply-To":"kieran.bingham@ideasonboard.com","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":12598,"web_url":"https://patchwork.libcamera.org/comment/12598/","msgid":"<20200920134043.GB4128@pendragon.ideasonboard.com>","date":"2020-09-20T13:40:43","subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Aug 24, 2020 at 11:39:00AM +0100, Kieran Bingham wrote:\n> On 23/08/2020 21:43, Laurent Pinchart wrote:\n> > On Sun, Aug 23, 2020 at 08:03:52PM +0000, email@uajain.com wrote:\n> >> On Aug 23, 2020 11:59 PM, Laurent Pinchart wrote:\n> >>> CameraDevice instances are managed through shared pointers to support\n> >>> hptplug. No reference is however taken on\n> >>\n> >> s/hptplug/hotplug/\n> >>\n> >>> the device when opened by the\n> >>> camera service, which could cause an open device to be deleted if\n> >>> unplugged, leading to a crash when the device is next accessed.\n> >>>\n> >>> Fix this by taking a reference when opening a device, and releasing it\n> >>> at close time. The reference is stored in the CameraDevice instance\n> >>> itself, which is more efficient than storing it in a container in the\n> >>> CameraHalManager as that would require lookup operations.\n> >>>\n> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >>> ---\n> >>> src/android/camera_device.cpp | 12 ++++++++++++\n> >>> src/android/camera_device.h   |  4 +++-\n> >>> 2 files changed, 15 insertions(+), 1 deletion(-)\n> >>>\n> >>> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> >>> index de6f86f7cb9b..52468be70781 100644\n> >>> --- a/src/android/camera_device.cpp\n> >>> +++ b/src/android/camera_device.cpp\n> >>> @@ -459,6 +459,12 @@ int CameraDevice::open(const hw_module_t\n> >>> *hardwareModule)\n> >>> camera3Device_.ops = &hal_dev_ops;\n> >>> camera3Device_.priv = this;\n> >>>\n> >>> + /*\n> >>> + * Hold a reference to ourselves, to protect against deletion if the\n> >>> + * camera is unplugged before being closed.\n> >>> + */\n> >>> + self_ = shared_from_this();\n> >>> +\n> >>> return 0;\n> >>> }\n> >>>\n> >>> @@ -468,6 +474,12 @@ void CameraDevice::close()\n> >>> camera_->release();\n> >>>\n> >>> running_ = false;\n> >>> +\n> >>> + /*\n> >>> + * Drop our self reference. From this point the CameraDevice may get\n> >>> + * deleted at any time.\n> >>> + */\n> >>> + self_.reset();\n> >>> }\n> \n> On initial glances, that sounds like a neat trick!, as long as the\n> open/close calls are symmetrical (or rather unique).\n> \n> >>>\n> >>> void CameraDevice::setCallbacks(const camera3_callback_ops_t *callbacks)\n> >>> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> >>> index 3934f194f1b5..fd991c76b90d 100644\n> >>> --- a/src/android/camera_device.h\n> >>> +++ b/src/android/camera_device.h\n> >>> @@ -44,7 +44,8 @@ struct CameraStream {\n> >>> Encoder *jpeg;\n> >>> };\n> >>>\n> >>> -class CameraDevice : protected libcamera::Loggable\n> >>> +class CameraDevice : public std::enable_shared_from_this<CameraDevice>,\n> >>> +      protected libcamera::Loggable\n> >>> {\n> >>> public:\n> >>> static std::shared_ptr<CameraDevice> create(unsigned int id,\n> >>> @@ -104,6 +105,7 @@ private:\n> >>>\n> >>> unsigned int id_;\n> >>> camera3_device_t camera3Device_;\n> >>> + std::shared_ptr<CameraDevice> self_;\n> >>>\n> >>> bool running_;\n> >>> std::shared_ptr<libcamera::Camera> camera_;\n> >>\n> >> Is this the patch after testing behaviour of a stream-able camera(probably non-\n> >> UVC) on CrOS with master? \n> > \n> > No it hasn't been tested. Sorry for not sending a cover letter to\n> > explain this. I should also have marked this as RFC.\n> > \n> >> I am not sure what this fix really achieves, part of the problem is because of\n> >> my build/test setup :(. I believe right now, the cros_camera_service exits\n> >> (\"sledge hammer\") when a ongoing streaming camera is unplugged, hence I am not\n> >> able to follow if ::Close() is called anywhere in hot unplug path. By that\n> >> extension, I am not sure if at all we are going to drop the manual ref we take,\n> >> as per this patch.\n> > \n> > The sledge hammer is triggered in the Chrome OS UVC HAL, in\n> > CameraHal::OnDeviceRemoved(). The Chrome OS camera service itself\n> > doesn't exit or abort explicitly when an open camera is disconnected,\n> > but that code path has probably received little testing.\n> > \n> > In order to test this we need to support software format conversion in\n> > the HAL to make UVC cameras usable on Chrome OS.\n> \n> I still wonder if we can quickly 'fake' this by creating a mapping for\n> the YUV or MJPEG formats on a camera to the NV12 format used by\n> AndroidHAL - the image wouldn't be visible, but as long as the camera\n> only writes smaller buffers (hence thinking the MJPEG might be better)\n> it could be a means to testing the hotplug functionality.\n\nWe probably could, but as software format conversion is in the pipe, I'm\nnot sure it makes much sense to invest lots of energy in this. I can\nkeep the patch in my tree for now (unless you think review is enough to\nupstream it).","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 CA38DBF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 20 Sep 2020 13:41:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 56AE362FAC;\n\tSun, 20 Sep 2020 15:41:18 +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 38ABA62E65\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 20 Sep 2020 15:41:16 +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 0901B4FB;\n\tSun, 20 Sep 2020 15:41:14 +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=\"E1SxZiRp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600609275;\n\tbh=EaqKoRv5Gu8sCOGYDCHab2nMiuFS27Qllh1aL83WkTo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=E1SxZiRpOE8KE0dYl2pS1HWBJX7q5G8Q8yDfCZ8RpB55hv3fSrP8TvIhxBYjAfNjN\n\txDZNMrT2xZQdwvyYFkZu/QAAWzMWGOlTBOPJzmzwKSOMELWiA9bD4p0TcBwEFOnbFY\n\tC8ButiSwbTewC7o2CdgJlohdmzFu1/Y+inu87768=","Date":"Sun, 20 Sep 2020 16:40:43 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20200920134043.GB4128@pendragon.ideasonboard.com>","References":"<20200823182900.18247-1-laurent.pinchart@ideasonboard.com>\n\t<773ac01d-ae1d-446c-864d-d7fb446ec81f@email.android.com>\n\t<20200823204317.GE6002@pendragon.ideasonboard.com>\n\t<0b994f11-0a94-bdc4-ed68-ab6f93b7470c@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<0b994f11-0a94-bdc4-ed68-ab6f93b7470c@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","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":12616,"web_url":"https://patchwork.libcamera.org/comment/12616/","msgid":"<868f4272-a821-c221-e025-6f009a64ecb6@ideasonboard.com>","date":"2020-09-21T09:58:05","subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 20/09/2020 14:40, Laurent Pinchart wrote:\n> Hi Kieran,\n> \n> On Mon, Aug 24, 2020 at 11:39:00AM +0100, Kieran Bingham wrote:\n>> On 23/08/2020 21:43, Laurent Pinchart wrote:\n>>> On Sun, Aug 23, 2020 at 08:03:52PM +0000, email@uajain.com wrote:\n>>>> On Aug 23, 2020 11:59 PM, Laurent Pinchart wrote:\n>>>>> CameraDevice instances are managed through shared pointers to support\n>>>>> hptplug. No reference is however taken on\n>>>>\n>>>> s/hptplug/hotplug/\n>>>>\n>>>>> the device when opened by the\n>>>>> camera service, which could cause an open device to be deleted if\n>>>>> unplugged, leading to a crash when the device is next accessed.\n>>>>>\n>>>>> Fix this by taking a reference when opening a device, and releasing it\n>>>>> at close time. The reference is stored in the CameraDevice instance\n>>>>> itself, which is more efficient than storing it in a container in the\n>>>>> CameraHalManager as that would require lookup operations.\n>>>>>\n>>>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>>>> ---\n>>>>> src/android/camera_device.cpp | 12 ++++++++++++\n>>>>> src/android/camera_device.h   |  4 +++-\n>>>>> 2 files changed, 15 insertions(+), 1 deletion(-)\n>>>>>\n>>>>> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n>>>>> index de6f86f7cb9b..52468be70781 100644\n>>>>> --- a/src/android/camera_device.cpp\n>>>>> +++ b/src/android/camera_device.cpp\n>>>>> @@ -459,6 +459,12 @@ int CameraDevice::open(const hw_module_t\n>>>>> *hardwareModule)\n>>>>> camera3Device_.ops = &hal_dev_ops;\n>>>>> camera3Device_.priv = this;\n>>>>>\n>>>>> + /*\n>>>>> + * Hold a reference to ourselves, to protect against deletion if the\n>>>>> + * camera is unplugged before being closed.\n>>>>> + */\n>>>>> + self_ = shared_from_this();\n>>>>> +\n>>>>> return 0;\n>>>>> }\n>>>>>\n>>>>> @@ -468,6 +474,12 @@ void CameraDevice::close()\n>>>>> camera_->release();\n>>>>>\n>>>>> running_ = false;\n>>>>> +\n>>>>> + /*\n>>>>> + * Drop our self reference. From this point the CameraDevice may get\n>>>>> + * deleted at any time.\n\nAnytime, when all other references are released ;-)\n\n>>>>> + */\n>>>>> + self_.reset();\n>>>>> }\n>>\n>> On initial glances, that sounds like a neat trick!, as long as the\n>> open/close calls are symmetrical (or rather unique).\n\nWhich is fine, because this can only be reached when we successfully\ncall camera_->acquire().\n\n\n>>\n>>>>>\n>>>>> void CameraDevice::setCallbacks(const camera3_callback_ops_t *callbacks)\n>>>>> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n>>>>> index 3934f194f1b5..fd991c76b90d 100644\n>>>>> --- a/src/android/camera_device.h\n>>>>> +++ b/src/android/camera_device.h\n>>>>> @@ -44,7 +44,8 @@ struct CameraStream {\n>>>>> Encoder *jpeg;\n>>>>> };\n>>>>>\n>>>>> -class CameraDevice : protected libcamera::Loggable\n>>>>> +class CameraDevice : public std::enable_shared_from_this<CameraDevice>,\n>>>>> +      protected libcamera::Loggable\n>>>>> {\n>>>>> public:\n>>>>> static std::shared_ptr<CameraDevice> create(unsigned int id,\n>>>>> @@ -104,6 +105,7 @@ private:\n>>>>>\n>>>>> unsigned int id_;\n>>>>> camera3_device_t camera3Device_;\n>>>>> + std::shared_ptr<CameraDevice> self_;\n>>>>>\n>>>>> bool running_;\n>>>>> std::shared_ptr<libcamera::Camera> camera_;\n>>>>\n>>>> Is this the patch after testing behaviour of a stream-able camera(probably non-\n>>>> UVC) on CrOS with master? \n>>>\n>>> No it hasn't been tested. Sorry for not sending a cover letter to\n>>> explain this. I should also have marked this as RFC.\n>>>\n>>>> I am not sure what this fix really achieves, part of the problem is because of\n>>>> my build/test setup :(. I believe right now, the cros_camera_service exits\n>>>> (\"sledge hammer\") when a ongoing streaming camera is unplugged, hence I am not\n>>>> able to follow if ::Close() is called anywhere in hot unplug path. By that\n>>>> extension, I am not sure if at all we are going to drop the manual ref we take,\n>>>> as per this patch.\n>>>\n>>> The sledge hammer is triggered in the Chrome OS UVC HAL, in\n>>> CameraHal::OnDeviceRemoved(). The Chrome OS camera service itself\n>>> doesn't exit or abort explicitly when an open camera is disconnected,\n>>> but that code path has probably received little testing.\n>>>\n>>> In order to test this we need to support software format conversion in\n>>> the HAL to make UVC cameras usable on Chrome OS.\n>>\n>> I still wonder if we can quickly 'fake' this by creating a mapping for\n>> the YUV or MJPEG formats on a camera to the NV12 format used by\n>> AndroidHAL - the image wouldn't be visible, but as long as the camera\n>> only writes smaller buffers (hence thinking the MJPEG might be better)\n>> it could be a means to testing the hotplug functionality.\n> \n> We probably could, but as software format conversion is in the pipe, I'm\n> not sure it makes much sense to invest lots of energy in this. I can\n> keep the patch in my tree for now (unless you think review is enough to\n> upstream it).\n\n\nI loathe putting in something completely untested, but looking through\nthis it sounds good (and factually correct, the object takes a reference\nto itself while the device is open, because it's being used while it's\nopen).\n\n\nIf you're confident that it's fine beyond a compile-check, then\nintegrate it.\n\nCode review wise, I'm happy:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>","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 A130ABF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Sep 2020 09:58:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 226C062FBF;\n\tMon, 21 Sep 2020 11:58:19 +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 2179460367\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Sep 2020 11:58:18 +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 5EF6927B;\n\tMon, 21 Sep 2020 11:58:12 +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=\"kLWExZHe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600682292;\n\tbh=cfAW/cqS/4MLoQEouW5dT6IGmJ7YAKc7K9dgxSV5oZ4=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=kLWExZHel315BTgpUv8P1pMD1vFokvBmpuMUNaCEjTToGXWptrlnrMh+f30RmJBjn\n\tpd/9oD7SePMqYwTUNkKuEVB/kG94kMMqh6NLQoTroPPM0gQoaf2m/Z8XP5MPpLOQqb\n\th/apF6dI8Gr9T5fOZudVgPtBjU6YwTDHlbO7eqpY=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20200823182900.18247-1-laurent.pinchart@ideasonboard.com>\n\t<773ac01d-ae1d-446c-864d-d7fb446ec81f@email.android.com>\n\t<20200823204317.GE6002@pendragon.ideasonboard.com>\n\t<0b994f11-0a94-bdc4-ed68-ab6f93b7470c@ideasonboard.com>\n\t<20200920134043.GB4128@pendragon.ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWi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h6bqkvBrDogAvuhf60Sogw+mH8b+PBlx1L\n\toeTK396wc+4c3BfiC6pNtUS5GpsPMMjYMk7kVvEAEQEAAYkCPAQYAQoAJgIbDBYhBJAt15g/\n\tvSj943LUeqEeRnIQpGH9BQJdizzIBQkLSKZiAAoJEKEeRnIQpGH9eYgQAJpjaWNgqNOnMTmD\n\tMJggbwjIotypzIXfhHNCeTkG7+qCDlSaBPclcPGYrTwCt0YWPU2TgGgJrVhYT20ierN8LUvj\n\t6qOPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz\n\tPZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp\n\tECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<868f4272-a821-c221-e025-6f009a64ecb6@ideasonboard.com>","Date":"Mon, 21 Sep 2020 10:58:05 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200920134043.GB4128@pendragon.ideasonboard.com>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH] android: camera_device: Hold\n\treference to self when open","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>","Reply-To":"kieran.bingham@ideasonboard.com","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>"}}]