Patch Detail
Show a patch.
GET /api/1.1/patches/15272/?format=api
{ "id": 15272, "url": "https://patchwork.libcamera.org/api/1.1/patches/15272/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15272/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220111201102.58256-1-vedantparanjape160201@gmail.com>", "date": "2022-01-11T20:11:02", "name": "[libcamera-devel,v2] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "67b1f9235563beb35da1d197714983ea8165bb0f", "submitter": { "id": 85, "url": "https://patchwork.libcamera.org/api/1.1/people/85/?format=api", "name": "Vedant Paranjape", "email": "vedantparanjape160201@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15272/mbox/", "series": [ { "id": 2889, "url": "https://patchwork.libcamera.org/api/1.1/series/2889/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2889", "date": "2022-01-11T20:11:02", "name": "[libcamera-devel,v2] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2889/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15272/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15272/checks/", "tags": {}, "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 844C7BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Jan 2022 20:11:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDE97604F8;\n\tTue, 11 Jan 2022 21:11:24 +0100 (CET)", "from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AF8160217\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 21:11:23 +0100 (CET)", "by mail-pl1-x62a.google.com with SMTP id i6so601373pla.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 12:11:23 -0800 (PST)", "from veware.localdomain ([1.186.165.49])\n\tby smtp.googlemail.com with ESMTPSA id\n\td1sm174992pgd.66.2022.01.11.12.11.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 11 Jan 2022 12:11:20 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"cdG6sFUt\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Anol0dhec9GwRQHBWXA/skFjGLIQpDGigQMRg9HrSxU=;\n\tb=cdG6sFUtGkCN3n7CCWZSimI5kWvWI6X6D7mv3/IWMMTJfGTCOBQFpp/SUqOJcVLoeb\n\t1YOILM3XtfpD879AYXOydbhmjpHjopeIf3W1+Kq138m95SqAGp/25uI4MU/bxTSFXFmb\n\tzibpMRLboeP8q/KWSkcuEAgeD3m0ap0qdk4T8TDKRF9OiNnVGMDdrTRh6yQTofnlZiB4\n\t24nFy2FvXZU8HDfFaMZbIoF6wIs0oEwB8UFMvppk4Xbbqbk392x5xFRpBJfNJU8Xzx4P\n\tFpCsA4dIAk3bD1q2RPJVTvddYAxCaPrbS4ioXBx6nLuf90ndfwjQqBz9jmuKe/3bk6+1\n\tIW+g==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Anol0dhec9GwRQHBWXA/skFjGLIQpDGigQMRg9HrSxU=;\n\tb=Sc1TxaNIHKcSaU6zfZ58KSbwbmH8hKUp9sSrWZoz1xtTQrvnB2TyAU8hiZAZ9akwX5\n\tJFeXJbx1pe+7wrv/wfNq2wz2wi/2y2F8ZN4MxLOAxpOZT8UDnxXq2c/H/zF0JRBOWn8p\n\tMs2nCJSC9L2pKaisjTd/UWLze0H0OpCsEIDK2A+Emvvaz/Nxe89sNGuAD8KIFDN4Dd9C\n\tdVT9b61Gak7jNgMpmFTqpzqC1AusQVrr5oekbbEPaysRPp9VXIMWLwtTRfz7iikuYdNI\n\t+IUSOxOrpebzK/aigT7RISGE15pHOoM0EOKsG+aok0AUHIs6Ebbu2JJwnWITHU2ohZak\n\tcnPA==", "X-Gm-Message-State": "AOAM530Vj/Zo0Yf4/QOydYwKjwSvBwdfS+dv8aGJ0UU2VN4TXjUW0rJl\n\tTt0G0VzXnQ37uoFlP8RzEag/0qNRKkE=", "X-Google-Smtp-Source": "ABdhPJwIGp/rYbSHKnr7Q5MmR+bLWv94EIZbZ0lm9FP422NH5xqtdd2hXMFZUCtcdN47xKNTjGOQYQ==", "X-Received": "by 2002:a17:902:8d91:b0:14a:486a:ac7 with SMTP id\n\tv17-20020a1709028d9100b0014a486a0ac7mr6136760plo.101.1641931881342; \n\tTue, 11 Jan 2022 12:11:21 -0800 (PST)", "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 12 Jan 2022 01:41:02 +0530", "Message-Id": "<20220111201102.58256-1-vedantparanjape160201@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support for\n\tPREPARE_BUF as one of the supported ioctl", "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": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add support for PREPARE_BUF as one of the ioctl. Since this is a compat\nlayer, there doesn't seem to be an equivalent to the \"transfer ownership\nof the buffer to kernel driver\" in V4L2Camera class.\n\nTo match the error checks done by kernel implementation, we'd have to\ncheck if dmabuf fd is valid and that the buffer size is large enough.\nDoing so will not add any particular value to the program as\napplications most likely don't depend on these conditions being\nhandled correctly.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 32 ++++++++++++++++++++++++++++++++\n src/v4l2/v4l2_camera_proxy.h | 1 +\n 2 files changed, 33 insertions(+)", "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 4d529bc29a4d..695af5be5c69 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -544,6 +544,37 @@ int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a\n \treturn 0;\n }\n \n+int V4L2CameraProxy::vidioc_prepare_buf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n+{\n+\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_prepare_buf, index = \"\n+\t\t\t << arg->index << \" fd = \" << file->efd();\n+\n+\tif (!hasOwnership(file))\n+\t\treturn -EBUSY;\n+\n+\tif (arg->index >= bufferCount_)\n+\t\treturn -EINVAL;\n+\n+\tif (arg->flags & V4L2_BUF_FLAG_REQUEST_FD)\n+\t\treturn -EINVAL;\n+\n+\tif (!validateBufferType(arg->type) ||\n+\t !validateMemoryType(arg->memory))\n+\t\treturn -EINVAL;\n+\n+\tstruct v4l2_buffer &buffer = buffers_[arg->index];\n+\n+\tif (buffer.flags & V4L2_BUF_FLAG_QUEUED ||\n+\t buffer.flags & V4L2_BUF_FLAG_PREPARED)\n+\t\treturn -EINVAL;\n+\n+\tbuffer.flags |= V4L2_BUF_FLAG_PREPARED;\n+\n+\targ->flags = buffer.flags;\n+\n+\treturn 0;\n+}\n+\n int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n {\n \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_qbuf, index = \"\n@@ -709,6 +740,7 @@ const std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = {\n \tVIDIOC_S_INPUT,\n \tVIDIOC_REQBUFS,\n \tVIDIOC_QUERYBUF,\n+\tVIDIOC_PREPARE_BUF,\n \tVIDIOC_QBUF,\n \tVIDIOC_DQBUF,\n \tVIDIOC_EXPBUF,\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 14e027c3e7d1..6baba94262a9 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -57,6 +57,7 @@ private:\n \tint vidioc_s_input(V4L2CameraFile *file, int *arg);\n \tint vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg);\n \tint vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *arg);\n+\tint vidioc_prepare_buf(V4L2CameraFile *file, struct v4l2_buffer *arg);\n \tint vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg);\n \tint vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \t\t\t libcamera::Mutex *lock) LIBCAMERA_TSA_REQUIRES(*lock);\n", "prefixes": [ "libcamera-devel", "v2" ] }