Show a patch.

GET /api/1.1/patches/14813/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14813,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14813/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14813/",
    "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": "<20211127192440.389551-1-vedantparanjape160201@gmail.com>",
    "date": "2021-11-27T19:24:40",
    "name": "[libcamera-devel] v4l2: V4L2CameraProxy: Add EXPBUF as one of the supported ioctl",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "208dffa8def65c86e735b4eb55e313e4e534cfed",
    "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/14813/mbox/",
    "series": [
        {
            "id": 2766,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2766/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2766",
            "date": "2021-11-27T19:24:40",
            "name": "[libcamera-devel] v4l2: V4L2CameraProxy: Add EXPBUF as one of the supported ioctl",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2766/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14813/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14813/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 BE5DABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Nov 2021 19:25:21 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D94316056A;\n\tSat, 27 Nov 2021 20:25:20 +0100 (CET)",
            "from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com\n\t[IPv6:2607:f8b0:4864:20::102d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A2F166011E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Nov 2021 20:25:19 +0100 (CET)",
            "by mail-pj1-x102d.google.com with SMTP id\n\tp18-20020a17090ad31200b001a78bb52876so12117217pju.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Nov 2021 11:25:19 -0800 (PST)",
            "from localhost.localdomain ([1.186.167.22])\n\tby smtp.googlemail.com with ESMTPSA id\n\tj13sm8141006pgg.5.2021.11.27.11.25.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 27 Nov 2021 11:25:17 -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=\"ent7D934\"; 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=A9Lv4dng6DV5RVbFC49/vWpXb1FmCaXCPo2s6qvAxG4=;\n\tb=ent7D934oNv5ImoQ1CmAx1S39Trm8D1iXaL+tbq+48hu2TGX9yjHToiuxAUh8mRe/6\n\tASuPvsXq2UQIrh0Ihy3k0T+FxmbDOHRrJBbTmqgHIrEeq8WAHi5FajY61XxcHb2fhhxe\n\toBf1C2YQQE/be0wRUW1x3/ebkyr8dyZ5ELN/zETqsLoSaTu8JM5QzTq3pa3/fg8sCPsY\n\toFMi8vRiTQXbvsuQ0lwzlxqulvns1FBiECSH19dczAEsnEqZ4twmI9gfmvjUOTsOsFJs\n\tK2N2l1QJqxZrPdoyoDNiipv1yWe+7ZY7BSwAOrahUgbJns844YTZZXNsgiEkmNuto3G7\n\tRQMg==",
        "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=A9Lv4dng6DV5RVbFC49/vWpXb1FmCaXCPo2s6qvAxG4=;\n\tb=XTWamVxwGED44rkPeUF60vF+o9qIxfiaGlhw1WwvlbDZq4+vSlK4BSkzbhpM+vF2gt\n\t6lCk5JL9MkvbWd9kGSr9EBGWzY+gCPGwAnVGOJNf1kvQgfXByHixVW6nPidOfFkEX1L1\n\t9V47iexaPVN911DSkVyamvR5G+TU5xtFg46svrUm9id6NjbioQ9MOZ/Hbe9vCNMj89eP\n\tA/bBf5vReHu5a7OZq8P9Kxze4GmFRQF9Ti2u05EVW4W77YIqPW43BmD+GnYmmRuIiESJ\n\tbnGrtlmQhP83PjnaJcuNb8KnTQbRPvs8WbVPFPi8M0tnPN0HyJRCA2HHeitImULyaFp4\n\tWLIA==",
        "X-Gm-Message-State": "AOAM531No77lDsPv6CCUK0w1W6OXlzHbr859gbWkff6tRQwSO9cPFVmA\n\tY22RisUiyXBz2mLVMngj1UfKW5+zZaQTBg==",
        "X-Google-Smtp-Source": "ABdhPJxn7umFzLRxALLvG4LVByEYb+c/DFIW99vLwYnr3q3traTYppn76l4PQJv+6mc/raobBaXOjg==",
        "X-Received": "by 2002:a17:902:7d96:b0:142:87dc:7dd3 with SMTP id\n\ta22-20020a1709027d9600b0014287dc7dd3mr46378126plm.11.1638041117453; \n\tSat, 27 Nov 2021 11:25:17 -0800 (PST)",
        "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 28 Nov 2021 00:54:40 +0530",
        "Message-Id": "<20211127192440.389551-1-vedantparanjape160201@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] v4l2: V4L2CameraProxy: Add EXPBUF as one\n\tof 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": "To support DMABUF as one of the memory buffer, we need to implement\nEXPBUF in the v4l2 compat layer.\n\nThis patch implements vidioc_expbuf as one of the supported ioctls.\n\nReference issue: https://bugs.libcamera.org/show_bug.cgi?id=89\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 41 +++++++++++++++++++++++++++++++++-\n src/v4l2/v4l2_camera_proxy.h   |  1 +\n 2 files changed, 41 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 3610e63cade3..03e3564bfed5 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n \n bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n {\n-\treturn memory == V4L2_MEMORY_MMAP;\n+\treturn (memory == V4L2_MEMORY_MMAP) ||\n+\t\t\t(memory == V4L2_MEMORY_DMABUF);\n }\n \n void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n@@ -624,6 +625,40 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \treturn 0;\n }\n \n+int V4L2CameraProxy::vidioc_expbuf(V4L2CameraFile *file, struct v4l2_exportbuffer *arg)\n+{\n+\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_expbuf fd = \" << file->efd();\n+\t/* \\todo Verify that the memory type is MMAP when adding DMABUF support */\n+\tif (!validateBufferType(arg->type))\n+\t\treturn -EINVAL;\n+\n+\tif (arg->index >= bufferCount_)\n+\t\treturn -EINVAL;\n+\n+\tif (arg->flags & ~(O_CLOEXEC | O_ACCMODE))\n+\t\treturn -EINVAL;\n+\n+\tLOG(V4L2Compat, Debug) << arg->index << \" : index of the buffer\";\n+\n+\tif (file->priority() < maxPriority())\n+\t\treturn -EBUSY;\n+\n+\tif (!hasOwnership(file) && owner_)\n+\t\treturn -EBUSY;\n+\n+\tmemset(arg->reserved, 0, sizeof(arg->reserved));\n+\n+\targ->fd = fcntl(buffers_[arg->index].m.fd,\n+\t\t\targ->flags & O_CLOEXEC ? F_DUPFD_CLOEXEC : F_DUPFD, 0);\n+\targ->fd = fcntl(arg->fd, F_SETFL, 0);\n+\n+\tLOG(V4L2Compat, Debug) << \"Exported buffer at index: \" << arg->index;\n+\n+\tacquire(file);\n+\n+\treturn 0;\n+}\n+\n int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n {\n \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << file->efd();\n@@ -685,6 +720,7 @@ const std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = {\n \tVIDIOC_QUERYBUF,\n \tVIDIOC_QBUF,\n \tVIDIOC_DQBUF,\n+\tVIDIOC_EXPBUF,\n \tVIDIOC_STREAMON,\n \tVIDIOC_STREAMOFF,\n };\n@@ -755,6 +791,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar\n \tcase VIDIOC_DQBUF:\n \t\tret = vidioc_dqbuf(file, static_cast<struct v4l2_buffer *>(arg), &locker);\n \t\tbreak;\n+\tcase VIDIOC_EXPBUF:\n+\t\tret = vidioc_expbuf(file, static_cast<struct v4l2_exportbuffer *>(arg));\n+\t\tbreak;\n \tcase VIDIOC_STREAMON:\n \t\tret = vidioc_streamon(file, static_cast<int *>(arg));\n \t\tbreak;\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex fccec241879d..81ef7788e9fe 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -58,6 +58,7 @@ private:\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::MutexLocker *locker);\n+\tint vidioc_expbuf(V4L2CameraFile *file, struct v4l2_exportbuffer *arg);\n \tint vidioc_streamon(V4L2CameraFile *file, int *arg);\n \tint vidioc_streamoff(V4L2CameraFile *file, int *arg);\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}