[{"id":20278,"web_url":"https://patchwork.libcamera.org/comment/20278/","msgid":"<20211018163805.banpbxpplpgfrusk@uno.localdomain>","date":"2021-10-18T16:38:05","subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Oct 18, 2021 at 06:59:22PM +0530, Umang Jain wrote:\n> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> The camera HAL APIs requires that any acquire fence that hasn't been\n> waited on to be sent back to the framework as a release fence. The\n> CameraDevice already copies the acquire fence to the release fence when\n> signaling request completion, but the CameraStream incorrectly closes\n> the fence when a wait times out and sets it to -1. Fix it.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/android/camera_stream.cpp | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index 9b5cd0c4..8e6ccb83 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -147,16 +147,16 @@ int CameraStream::process(const FrameBuffer &source,\n>  \t\t\t  Camera3RequestDescriptor *request)\n>  {\n>  \t/* Handle waiting on fences on the destination buffer. */\n> -\tint fence = dest.fence;\n> -\tif (fence != -1) {\n> -\t\tint ret = waitFence(fence);\n> -\t\t::close(fence);\n> -\t\tdest.fence = -1;\n> +\tif (dest.fence != -1) {\n> +\t\tint ret = waitFence(dest.fence);\n>  \t\tif (ret < 0) {\n\nIf the only reason why a fence should not be closed is a timeout,\nshouldn't we inspect the return error code then ?\n\n>  \t\t\tLOG(HAL, Error) << \"Failed waiting for fence: \"\n> -\t\t\t\t\t<< fence << \": \" << strerror(-ret);\n> +\t\t\t\t\t<< dest.fence << \": \" << strerror(-ret);\n>  \t\t\treturn ret;\n>  \t\t}\n> +\n> +\t\t::close(dest.fence);\n> +\t\tdest.fence = -1;\n>  \t}\n>\n>  \tif (!postProcessor_)\n> --\n> 2.31.0\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 406E6C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Oct 2021 16:37:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B094868F5B;\n\tMon, 18 Oct 2021 18:37:17 +0200 (CEST)","from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EC4968F56\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Oct 2021 18:37:16 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 1015A200006;\n\tMon, 18 Oct 2021 16:37:15 +0000 (UTC)"],"Date":"Mon, 18 Oct 2021 18:38:05 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<20211018163805.banpbxpplpgfrusk@uno.localdomain>","References":"<20211018132923.476242-1-umang.jain@ideasonboard.com>\n\t<20211018132923.476242-11-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211018132923.476242-11-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","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>"}},{"id":20281,"web_url":"https://patchwork.libcamera.org/comment/20281/","msgid":"<YW2wK4b34QBTuAzA@pendragon.ideasonboard.com>","date":"2021-10-18T17:34:35","subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Oct 18, 2021 at 06:38:05PM +0200, Jacopo Mondi wrote:\n> On Mon, Oct 18, 2021 at 06:59:22PM +0530, Umang Jain wrote:\n> > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >\n> > The camera HAL APIs requires that any acquire fence that hasn't been\n> > waited on to be sent back to the framework as a release fence. The\n> > CameraDevice already copies the acquire fence to the release fence when\n> > signaling request completion, but the CameraStream incorrectly closes\n> > the fence when a wait times out and sets it to -1. Fix it.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/android/camera_stream.cpp | 12 ++++++------\n> >  1 file changed, 6 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> > index 9b5cd0c4..8e6ccb83 100644\n> > --- a/src/android/camera_stream.cpp\n> > +++ b/src/android/camera_stream.cpp\n> > @@ -147,16 +147,16 @@ int CameraStream::process(const FrameBuffer &source,\n> >  \t\t\t  Camera3RequestDescriptor *request)\n> >  {\n> >  \t/* Handle waiting on fences on the destination buffer. */\n> > -\tint fence = dest.fence;\n> > -\tif (fence != -1) {\n> > -\t\tint ret = waitFence(fence);\n> > -\t\t::close(fence);\n> > -\t\tdest.fence = -1;\n> > +\tif (dest.fence != -1) {\n> > +\t\tint ret = waitFence(dest.fence);\n> >  \t\tif (ret < 0) {\n> \n> If the only reason why a fence should not be closed is a timeout,\n> shouldn't we inspect the return error code then ?\n\nOr we should update the commit message. If we don't successfully wait on\na fence, I think it should be passed back to the camera service (I'm not\nsure what other conditions could arise though, it's probably theoretical\nonly).\n\ns/times out/fails/\n\nin the subject and commit message.\n\n> >  \t\t\tLOG(HAL, Error) << \"Failed waiting for fence: \"\n> > -\t\t\t\t\t<< fence << \": \" << strerror(-ret);\n> > +\t\t\t\t\t<< dest.fence << \": \" << strerror(-ret);\n> >  \t\t\treturn ret;\n> >  \t\t}\n> > +\n> > +\t\t::close(dest.fence);\n> > +\t\tdest.fence = -1;\n> >  \t}\n> >\n> >  \tif (!postProcessor_)","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 DEB03C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Oct 2021 17:34:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 403B868F59;\n\tMon, 18 Oct 2021 19:34:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 091D168F56\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Oct 2021 19:34:53 +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 6F6DD8C6;\n\tMon, 18 Oct 2021 19:34:52 +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=\"YA1jLCyi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634578492;\n\tbh=8SoU25Pywl727w2IA1wxkmeIuJInO4KvK69NuooZHx0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YA1jLCyidF5r1HbiCR7CeCqcPRamLQN8Bd0EeggS/7RXUo9YRBZF5dhzDdIRrC1ef\n\tRmn/HSE43lphC0tzQlWlg3zpDE8n/8IRZAkR6xOT5DSHpLBSpnZmUI98pN95rw9P+n\n\tEV66FOrK/N8OGuAF9YxWo/ICLxEw+N7LhBTpVyvk=","Date":"Mon, 18 Oct 2021 20:34:35 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YW2wK4b34QBTuAzA@pendragon.ideasonboard.com>","References":"<20211018132923.476242-1-umang.jain@ideasonboard.com>\n\t<20211018132923.476242-11-umang.jain@ideasonboard.com>\n\t<20211018163805.banpbxpplpgfrusk@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211018163805.banpbxpplpgfrusk@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","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>"}},{"id":20298,"web_url":"https://patchwork.libcamera.org/comment/20298/","msgid":"<ca38f57c-37ca-fdf6-a3a3-ecb42ea365f5@ideasonboard.com>","date":"2021-10-19T10:58:03","subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello,\n\nOn 10/18/21 6:59 PM, Umang Jain wrote:\n> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> The camera HAL APIs requires that any acquire fence that hasn't been\n> waited on to be sent back to the framework as a release fence. The\n> CameraDevice already copies the acquire fence to the release fence when\n> signaling request completion, but the CameraStream incorrectly closes\n> the fence when a wait times out and sets it to -1. Fix it.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Umang Jain<umang.jain@ideasonboard.com>\n\n> ---\n>   src/android/camera_stream.cpp | 12 ++++++------\n>   1 file changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index 9b5cd0c4..8e6ccb83 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -147,16 +147,16 @@ int CameraStream::process(const FrameBuffer &source,\n>   \t\t\t  Camera3RequestDescriptor *request)\n>   {\n>   \t/* Handle waiting on fences on the destination buffer. */\n> -\tint fence = dest.fence;\n> -\tif (fence != -1) {\n> -\t\tint ret = waitFence(fence);\n> -\t\t::close(fence);\n> -\t\tdest.fence = -1;\n> +\tif (dest.fence != -1) {\n> +\t\tint ret = waitFence(dest.fence);\n>   \t\tif (ret < 0) {\n>   \t\t\tLOG(HAL, Error) << \"Failed waiting for fence: \"\n> -\t\t\t\t\t<< fence << \": \" << strerror(-ret);\n> +\t\t\t\t\t<< dest.fence << \": \" << strerror(-ret);\n>   \t\t\treturn ret;\n>   \t\t}\n> +\n> +\t\t::close(dest.fence);\n> +\t\tdest.fence = -1;\n>   \t}\n>   \n>   \tif (!postProcessor_)","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 C6175C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Oct 2021 10:58:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 964E2604FF;\n\tTue, 19 Oct 2021 12:58:09 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7EF0604FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Oct 2021 12:58:08 +0200 (CEST)","from [192.168.1.106] (unknown [103.251.226.98])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1864A12A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Oct 2021 12:58:07 +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=\"QczdVh56\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634641088;\n\tbh=IjFwnjUNtK6qcEMd1EtcdzqZd+ZlmELBudWztCcxWds=;\n\th=Subject:From:To:References:Date:In-Reply-To:From;\n\tb=QczdVh56h9DZ22LZn4g1TrESSB7id6UUjF7LuOFjTFHDqtVJl+W6kdVH8GEYD6ZHV\n\tQLxndBSsxF9b3ZjHf3PFb1AvtyGfip9hnvFNRd+Shc7LCPLqrqPhT1/My9CoqxFz/J\n\tSXFKYae/a307WXyr5EdEImfbGkB8Vft9NXt5v3NQ=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","References":"<20211018132923.476242-1-umang.jain@ideasonboard.com>\n\t<20211018132923.476242-11-umang.jain@ideasonboard.com>","Message-ID":"<ca38f57c-37ca-fdf6-a3a3-ecb42ea365f5@ideasonboard.com>","Date":"Tue, 19 Oct 2021 16:28:03 +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":"<20211018132923.476242-11-umang.jain@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 10/11] android: camera_stream: Don't\n\tclose fence if wait times out","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>"}}]