{"id":14851,"url":"https://patchwork.libcamera.org/api/1.1/patches/14851/?format=json","web_url":"https://patchwork.libcamera.org/patch/14851/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211129194031.1340933-1-vedantparanjape160201@gmail.com>","date":"2021-11-29T19:40:31","name":"[libcamera-devel,v1] v4l2: V4L2CameraProxy: Add support for DMABUF buffer I/O in REQBUF ioctl","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"721eda0eef445f6673fceec0dfab4423d6bea8a3","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/1.1/people/85/?format=json","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14851/mbox/","series":[{"id":2774,"url":"https://patchwork.libcamera.org/api/1.1/series/2774/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2774","date":"2021-11-29T19:40:31","name":"[libcamera-devel,v1] v4l2: V4L2CameraProxy: Add support for DMABUF buffer I/O in REQBUF ioctl","version":1,"mbox":"https://patchwork.libcamera.org/series/2774/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14851/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14851/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 DA420BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 19:40:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 420E9605A4;\n\tMon, 29 Nov 2021 20:40:49 +0100 (CET)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AABD460592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 20:40:47 +0100 (CET)","by mail-pl1-x629.google.com with SMTP id u17so13013839plg.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 11:40:47 -0800 (PST)","from localhost.localdomain ([1.186.167.22])\n\tby smtp.googlemail.com with ESMTPSA id\n\ty190sm18113039pfg.153.2021.11.29.11.40.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Nov 2021 11:40:44 -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=\"LULegJHj\"; 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=nyA9U/+rc8LaPo/Tjndn7ffz4hL25lQSguudTP+rbJg=;\n\tb=LULegJHjmccqYSlNmtU8t1AJEShZk8fXJk/gUOZepWlRyr+2+onGJmYxgVm1ratafs\n\t19l3g3tTUV8nPDQMcI0DVAHkxLEJeNBXSegbnkjzLPVw7vQEtqCQnMAIVBEuD/hoNun9\n\tLJEiZRAoEMMJLuaIQD9MbIkrf4o/nu2oEY8e43RF6xNov8a74V/4ui5m9ORWFq/kpbtR\n\t/ggxxboZvRnjaac7jrwzyndXHeiHk+LLu6WmrsD78FP8/hnlW5KGnO87Wr+XYZV73+EU\n\tMwCPt4FJCD2Ba8YhO1ulqoUOUv/uo6D4a8Zw6qJX8Tbb59S8HXjT7RZIbRS6nv4Vu5Mz\n\tPpqg==","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=nyA9U/+rc8LaPo/Tjndn7ffz4hL25lQSguudTP+rbJg=;\n\tb=7CPyvIZvsOdxU8R5E4y/ldoUadJRSyYC4Q+J6oLr3eqJ3AlTiDLtEmNtERNWTtZpeF\n\t4rUFJODeDCtPSMOxSp8JOs5egdKGmTqw5eXTvlSr8rMZekbxFw9tHjGymm0vMxblCQ8L\n\trhWF1vSGE0/UtMhalbX5UaWb0eJqlNXPD995DSoe8x5mByIwVZDJZBBO2uZdKJg4/MHe\n\tq3a7yOq5loyj9L7Epce2pYCfvcH+fbOCDvijRVbBgZd8qVIikYgepqdvDtlvq0gB6bs0\n\teJB+jaP9w4PtGDAjxaUVxD78jwGD7mpnR0vqMVFb/S5T9YM+a7mq+evgj2CfsBGb0Pot\n\txxKQ==","X-Gm-Message-State":"AOAM532Q7Eqh6BdcEjHzt8/IL/sxFo9TNNoTTaHz8vYejCy3f0pakHMl\n\tQTUKZmhpaKwyOqg50FMuz+KZy5pmkkxpOQ==","X-Google-Smtp-Source":"ABdhPJwGg5SEx+xmBCnkHhgii4oLwVAzPz6ha9FYIiTNcs8bvw7TVDIcbQ1leYVgMCo85IP5SgG4og==","X-Received":"by 2002:a17:90b:4b51:: with SMTP id\n\tmi17mr197726pjb.48.1638214845280; \n\tMon, 29 Nov 2021 11:40:45 -0800 (PST)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 30 Nov 2021 01:10:31 +0530","Message-Id":"<20211129194031.1340933-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\tDMABUF buffer I/O in REQBUF 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 importing DMABUF, we need to reqbufs with DMABUF mode.\n\nThis patch enables using V4L2_MEMORY_DMABUF as one of the memory types\nin vidioc_reqbuf to initialise DMA Buffer I/O\n\nBug: 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 | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex f194e06345b7..c8861a531399 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@@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \tif (!hasOwnership(file) && owner_)\n \t\treturn -EBUSY;\n \n-\targ->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n+\targ->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n+\t\t\t\t\t\t   V4L2_BUF_CAP_SUPPORTS_DMABUF;\n \tmemset(arg->reserved, 0, sizeof(arg->reserved));\n \n \tif (arg->count == 0) {\n@@ -511,11 +513,15 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \t\tstruct v4l2_buffer buf = {};\n \t\tbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n \t\tbuf.length = v4l2PixFormat_.sizeimage;\n-\t\tbuf.memory = V4L2_MEMORY_MMAP;\n-\t\tbuf.m.offset = i * v4l2PixFormat_.sizeimage;\n+\t\tbuf.memory = arg->memory;\n \t\tbuf.index = i;\n \t\tbuf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\n \n+\t\tif (arg->memory == V4L2_MEMORY_MMAP)\n+\t\t\tbuf.m.offset = i * v4l2PixFormat_.sizeimage;\n+\t\telse if (arg->memory == V4L2_MEMORY_DMABUF)\n+\t\t\tbuf.m.fd = vcam_->getBufferFd(i).fd();\n+\n \t\tbuffers_[i] = buf;\n \t}\n \n","prefixes":["libcamera-devel","v1"]}