Patch Detail
Show a patch.
GET /api/1.1/patches/15271/?format=api
{ "id": 15271, "url": "https://patchwork.libcamera.org/api/1.1/patches/15271/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15271/", "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": "<20220111163329.363418-1-vedantparanjape160201@gmail.com>", "date": "2022-01-11T16:33:29", "name": "[libcamera-devel,v1] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8bb55e12812d97a6c23b6784db52dbc056ac0d00", "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/15271/mbox/", "series": [ { "id": 2888, "url": "https://patchwork.libcamera.org/api/1.1/series/2888/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2888", "date": "2022-01-11T16:33:29", "name": "[libcamera-devel,v1] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2888/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15271/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15271/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 9AF69BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Jan 2022 16:33:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6B8D604F4;\n\tTue, 11 Jan 2022 17:33:55 +0100 (CET)", "from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com\n\t[IPv6:2607:f8b0:4864:20::1031])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B0EA60217\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 17:33:53 +0100 (CET)", "by mail-pj1-x1031.google.com with SMTP id\n\tb1-20020a17090a990100b001b14bd47532so6902460pjp.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 08:33:53 -0800 (PST)", "from veware.localdomain ([1.186.165.49])\n\tby smtp.googlemail.com with ESMTPSA id\n\tk9sm8791062pgr.47.2022.01.11.08.33.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 11 Jan 2022 08:33:51 -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=\"h5Yn6891\"; 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=mGUeGq6evKHForXYdo1fcUpl5aq6IRP3aa3nfI63WWY=;\n\tb=h5Yn6891rynMAlbExaYGha9+YjRVlbYfJiWt6KUENBP3sWJdp4jRYGLg47KvdlM6M6\n\tjBwQOMSeDPSy5b+F4upQdCXQ+JVGrQn/0XhL5fjOVew/dOixfI829+/6CPgT0Vx5preS\n\tCJ6vUG7IZlRS0HnHcwZPc9ti7wKFHjwV+O12WqcyfOcjSqRdF7/eiwONotvyUPE3n6qs\n\t+f0lqOheveg7bmjEm7U+OqLmAOj1+j33J/No1T1jc+pc7Pxh2xkGpdj76Y5bixJopmyp\n\te55wGdYBtn7JEHYWQzm7SREVy6A1Zctx2Rh0cSHEou+w135uJfAEr+rzs0gd17HQECZP\n\trrDg==", "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=mGUeGq6evKHForXYdo1fcUpl5aq6IRP3aa3nfI63WWY=;\n\tb=xIHLakLGb1cwn7gk+egFCqgcFy0z3gpJx2Dc2JyK0Pm8Z6/kPLHX/ejBJhhkMumUNs\n\tChG3AeypgJl1O5M22TVq7AyKY02qCEFXCSSgjoZJAnDADyhC3c9wvrDvrDYT4IKr7DQJ\n\tuVmR96c+uhdB4KIpUn8VbQOAEcvYMOGG/VFrPxn5qip4Gusq0KCvFg4aDO7KkHPml+Ex\n\t4vqarlu4wf3c0OyWfG9JsrIbGk7ywNlHQ035udEuIewifTJIfRN3NZoEKyNV+mkwiRHj\n\tYzEBLp1B8zvq57LciWsKNt+lDaQO0LrkUi/YnjKYjL/wPTdslEBAqfrPnibqMfzZcPZj\n\toeEw==", "X-Gm-Message-State": "AOAM533C8szA2djqKugUZhFnwekM6sMrAnQ2kNUskUWVgO0ovWZ3BRdK\n\tauDHUQWJSEAK6dmvk1t/quHg59PgIiw=", "X-Google-Smtp-Source": "ABdhPJxK3xrBKjzuCIw5wBv+E9h37zCY8CGd+Y4hu54FjrItmVOm7VduggNpQ/S0XpwkCC8WxFSBUg==", "X-Received": "by 2002:a17:902:e741:b0:14a:5a65:dcdb with SMTP id\n\tp1-20020a170902e74100b0014a5a65dcdbmr2173891plf.135.1641918831365; \n\tTue, 11 Jan 2022 08:33:51 -0800 (PST)", "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 11 Jan 2022 22:03:29 +0530", "Message-Id": "<20220111163329.363418-1-vedantparanjape160201@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1] 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 don't depend on these conditions being handled correctly.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\nSource builds and tests fine, also passes the v4l2-compliance\n\n<snip>\nvedant@pc ~/libcamera$ ./test/v4l2_compat/v4l2_compat_test.py ./build/src/v4l2/v4l2-compat.so\nTesting /dev/video0 with uvcvideo driver... success\n</snip>\n\nStill figuring out how to test this with v4l2-ctl, if you have hints\nplease let me know :)\n---\nsrc/v4l2/v4l2_camera_proxy.cpp | 28 ++++++++++++++++++++++++++++\n src/v4l2/v4l2_camera_proxy.h | 1 +\n 2 files changed, 29 insertions(+)", "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 4d529bc29a4d..8c28e8738a06 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -544,6 +544,33 @@ 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 (buffers_[arg->index].flags & V4L2_BUF_FLAG_REQUEST_FD ||\n+\t buffers_[arg->index].flags & V4L2_BUF_FLAG_PREPARED)\n+\t\treturn -EINVAL;\n+\n+\tif (buffers_[arg->index].flags & V4L2_BUF_FLAG_QUEUED ||\n+\t !validateBufferType(arg->type) ||\n+\t !validateMemoryType(arg->memory))\n+\t\treturn -EINVAL;\n+\n+\tbuffers_[arg->index].flags |= V4L2_BUF_FLAG_PREPARED;\n+\n+\targ->flags = buffers_[arg->index].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 +736,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", "v1" ] }