[{"id":5366,"web_url":"https://patchwork.libcamera.org/comment/5366/","msgid":"<20200623231439.GP5870@pendragon.ideasonboard.com>","date":"2020-06-23T23:14:39","subject":"Re: [libcamera-devel] [PATCH v3 21/22] v4l2: v4l2_camera_proxy: Fix\n\tbuffer flags related to queueing","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Wed, Jun 24, 2020 at 04:08:35AM +0900, Paul Elder wrote:\n> Fix buffer flags related to queueing and dequeueing:\n> - don't allow a buffer with the same index that is already in the queue\n>   to be enqueued again\n> - don't set the done flag on dequeueing in\n>   V4L2CameraProxy::updateBuffers()\n> - set the flags in V4L2CameraProxy's internal buffers, and not just in\n>   the buffers returned from qbuf\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> Changes in v3:\n> - remove \"set the mapped flag on enqueueing\"\n> - clean up some logic\n> - expand commit message very slightly\n> \n> New in v2\n> - split from \"Fix v4l2-compliance streaming tests\"\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 10 +++++++---\n>  1 file changed, 7 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index ce0d755..ed3bcbc 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -219,7 +219,6 @@ void V4L2CameraProxy::updateBuffers()\n>  \t\t\tbuf.timestamp.tv_usec = fmd.timestamp % 1000000;\n>  \t\t\tbuf.sequence = fmd.sequence;\n>  \n> -\t\t\tbuf.flags |= V4L2_BUF_FLAG_DONE;\n\nI think this hunk is incorrect, V4L2_BUF_FLAG_DONE isn't set anywhere\nanymore. The rest looks good, with this line restored,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\t\tbreak;\n>  \t\tcase FrameMetadata::FrameError:\n>  \t\t\tbuf.flags |= V4L2_BUF_FLAG_ERROR;\n> @@ -570,6 +569,9 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  \tif (arg->index >= bufferCount_)\n>  \t\treturn -EINVAL;\n>  \n> +\tif (buffers_[arg->index].flags & V4L2_BUF_FLAG_QUEUED)\n> +\t\treturn -EINVAL;\n> +\n>  \tif (!hasOwnership(file))\n>  \t\treturn -EBUSY;\n>  \n> @@ -582,8 +584,10 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> -\targ->flags |= V4L2_BUF_FLAG_QUEUED;\n> -\targ->flags &= ~V4L2_BUF_FLAG_DONE;\n> +\tbuffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED;\n> +\tbuffers_[arg->index].flags &= ~V4L2_BUF_FLAG_DONE;\n> +\n> +\targ->flags = buffers_[arg->index].flags;\n>  \n>  \treturn ret;\n>  }","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 34236603B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2020 01:15:06 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C6372A9;\n\tWed, 24 Jun 2020 01:15:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"MOfmK2Qm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592954105;\n\tbh=YQ7VYorMy6hX1KHSgMTIM9f8Pg29Ez5NOBKByMtALvA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=MOfmK2QmqiQ/CcGC1dELmL3h9y/DrJ2uB7tRfNikd/jRRXnXa8rulE//Fx3HORT6r\n\td1eZLGOsXkxVQzqoXN1LfS6UZXIG9fdwVD7pFUm69+BviS7jMwqyWqHl2fa4T3qkpw\n\tBxsp1KJB/W4Wywc+norhcIYSlfmWBG4Zs4SNfyCI=","Date":"Wed, 24 Jun 2020 02:14:39 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200623231439.GP5870@pendragon.ideasonboard.com>","References":"<20200623190836.53446-1-paul.elder@ideasonboard.com>\n\t<20200623190836.53446-22-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200623190836.53446-22-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 21/22] v4l2: v4l2_camera_proxy: Fix\n\tbuffer flags related to queueing","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>","X-List-Received-Date":"Tue, 23 Jun 2020 23:15:06 -0000"}}]