Show a patch.

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

{
    "id": 15288,
    "url": "https://patchwork.libcamera.org/api/patches/15288/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15288/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20220119055512.31893-1-vedantparanjape160201@gmail.com>",
    "date": "2022-01-19T05:55:12",
    "name": "[libcamera-devel,v3] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl",
    "commit_ref": "b5225f00cde0f84437349955050c27d89a76e550",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4c15a73732e8152fb064032210e1c7e15fad96ed",
    "submitter": {
        "id": 85,
        "url": "https://patchwork.libcamera.org/api/people/85/?format=api",
        "name": "Vedant Paranjape",
        "email": "vedantparanjape160201@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15288/mbox/",
    "series": [
        {
            "id": 2898,
            "url": "https://patchwork.libcamera.org/api/series/2898/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2898",
            "date": "2022-01-19T05:55:12",
            "name": "[libcamera-devel,v3] v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2898/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15288/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15288/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 79791BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Jan 2022 05:55:34 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8571960944;\n\tWed, 19 Jan 2022 06:55:33 +0100 (CET)",
            "from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com\n\t[IPv6:2607:f8b0:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5AC1C6017D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jan 2022 06:55:32 +0100 (CET)",
            "by mail-pf1-x42a.google.com with SMTP id w204so1564865pfc.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Jan 2022 21:55:32 -0800 (PST)",
            "from veware.localdomain ([1.186.167.236])\n\tby smtp.googlemail.com with ESMTPSA id\n\to64sm18719215pfb.27.2022.01.18.21.55.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 18 Jan 2022 21:55:30 -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=\"LtLO7VnX\"; 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=OYMO8G+/b4muA9FspyJl9PuJNrV8eSBIqDQLWfSQzWo=;\n\tb=LtLO7VnX1tOILRFY9u58ve6yEEqMFfVgyD3p2bFYYRflDPnBV7g0pqZo79g+CyT0XU\n\t13bK5xbaZ1yF168ccylAjgUYoD1NqNl34EfMxMM01JUp746p0corQfnKb6951xk4Wzoj\n\tWfQZ/EkCiM2ygSACQpzKXD7pp7Ni9SSVA3zW0pQWuNh0GLpv1U8VdHuo7IwYqK7EBD1W\n\tC71OssZPJsMiz+LLYqz59YgvGI/AzWjaNwIfE2CXybheE3ulLPBsxAfLYOJ2vhVLx8C8\n\tFFy6EfuGo2XEEeuHveCyXOr9aTQ9VAMfggXL4w9X081W9i05n51QgrfeKceO+Mn9XtS7\n\tVtrQ==",
        "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=OYMO8G+/b4muA9FspyJl9PuJNrV8eSBIqDQLWfSQzWo=;\n\tb=NhBj1uo5e7VegVhczpi/rdFfwiOSLSEPemRe5FB8+DfrO3A9R+UlQ03IhnRu0DV1ro\n\tDeAgIuKdI94h2uWnAU/BhzA424X1MBOYDRZS01+RIR16j6UwVsaqfgkPX4diB+vk4FHb\n\tpN9WaDW3ZCOGXouNpfEGjTw51bfydl1BldzODnHMiveCHDFGaidQgToX46uc1sS7lmS+\n\tn9Mb+9dzBFII8OqUoZz/Lrkjx/Jq6VccZJBUYfsqH4HXFTmpzhIsMAgU8DogpDstH83T\n\t4TpCME1cusbgDj9fzfnZETRV/0R2wvvbAyu90995MRnUdp0jtsFghlUSHA3Vo8GYL5Eh\n\tV9ZA==",
        "X-Gm-Message-State": "AOAM531eIELVRQj9Dq8LuPLKvkyafYh2+9F2QT6hK9t1Wki+yd9wisW0\n\tODVy/JPj7P6R+sHsf/KSSF5yNyOOEeAIs6ST",
        "X-Google-Smtp-Source": "ABdhPJxfOyE/oq7+FD+WCk7vuA/2Ys/ci+oWcuOy4ERzrC/hyERXfQr1WoKKv7NcWqkUOb9RJh34UA==",
        "X-Received": "by 2002:a62:7997:0:b0:4bf:508a:2f78 with SMTP id\n\tu145-20020a627997000000b004bf508a2f78mr29424954pfc.16.1642571730466; \n\tTue, 18 Jan 2022 21:55:30 -0800 (PST)",
        "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 19 Jan 2022 11:25:12 +0530",
        "Message-Id": "<20220119055512.31893-1-vedantparanjape160201@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3] 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 | 35 +++++++++++++++++++++++++++++++++-\n src/v4l2/v4l2_camera_proxy.h   |  1 +\n 2 files changed, 35 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex ec6daac605fb..f3470a6d312a 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -559,6 +559,38 @@ 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)\n+\t\t<< \"[\" << file->description() << \"] \" << __func__\n+\t\t<< \"(index=\" << arg->index << \")\";\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)\n@@ -627,7 +659,7 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n \n \tstruct v4l2_buffer &buf = buffers_[currentBuf_];\n \n-\tbuf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);\n+\tbuf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_PREPARED);\n \tbuf.length = sizeimage_;\n \t*arg = buf;\n \n@@ -729,6 +761,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 a38b28c744d3..76ca2d8a5558 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_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",
        "v3"
    ]
}