{"id":14849,"url":"https://patchwork.libcamera.org/api/1.1/patches/14849/?format=json","web_url":"https://patchwork.libcamera.org/patch/14849/","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":"<20211129161336.1113408-1-vedantparanjape160201@gmail.com>","date":"2021-11-29T16:13:36","name":"[libcamera-devel,v3] v4l2: V4L2CameraProxy: Add EXPBUF as one of the supported ioctl","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f67d927d423c5b9d7e80456a6aa371dd5bf2a621","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/14849/mbox/","series":[{"id":2772,"url":"https://patchwork.libcamera.org/api/1.1/series/2772/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2772","date":"2021-11-29T16:13:36","name":"[libcamera-devel,v3] v4l2: V4L2CameraProxy: Add EXPBUF as one of the supported ioctl","version":3,"mbox":"https://patchwork.libcamera.org/series/2772/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14849/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14849/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 096E1BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 16:14:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2ECC2605A4;\n\tMon, 29 Nov 2021 17:14:24 +0100 (CET)","from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com\n\t[IPv6:2607:f8b0:4864:20::102b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D13860592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 17:14:23 +0100 (CET)","by mail-pj1-x102b.google.com with SMTP id\n\to6-20020a17090a0a0600b001a64b9a11aeso14643304pjo.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 08:14:23 -0800 (PST)","from localhost.localdomain ([1.186.167.22])\n\tby smtp.googlemail.com with ESMTPSA id\n\tc81sm17194086pfb.166.2021.11.29.08.14.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Nov 2021 08:14:21 -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=\"Uj7uubmS\"; 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=vbDv8gqwB80fRZtvOL3n45EDyJArTKuosRQKZ2mPm0M=;\n\tb=Uj7uubmS5EaHyNvAn5mlT9EI9jqWyv8jB6uHKLN0BPRk98sUjW/lfx1AIhWF1oRYWs\n\tdLi26Qfsjj1NJAoCCgsS3hCq2nyid+y/ziyJbtScb/TnS1RuCsLoxVAXLQmLk1Gxdwqy\n\tWUTQ22ljfCNfSvXi50rEc4F5E1AzsEzS9H6h9BpCa03Gj69s7sxzBmbF7yF8GjUG9jFh\n\taBsotwu6mLDcJwDHJIH0z06itGddREeLjyPO7i1fX0pOkfGGbLWlaN/kroKqEplPTom3\n\tuVHB7poLiJ+RVnLeAOj2chZqHEw/KZQHzwxN6+v7usSuPYa0sq1wQHfcBHj7Wv3o2ATg\n\t/UvQ==","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=vbDv8gqwB80fRZtvOL3n45EDyJArTKuosRQKZ2mPm0M=;\n\tb=nWjNtWstZ1F4wuYtgONadFPp2yclFgWMBnpBJv1W+77pWXkfP/yw845oAmaaQ2tWnF\n\t6LoHp8yYD4mvZUFO+0N9E0coO6uvafYWj7SXht5fZvy9TEwZr68ydS6dxKTk6Mk7K88r\n\tnLzp0Xg/irV5PWACjKGb3eRHNOeFLQX1wHBBPmwAqLnzTahCy+8ZwjRxzM1hLfb7mDQx\n\tQZxGv2MtQaXpr8wB0hInULGjta4sBs07Pp+aM1kldgphPYXb3EMjJ3F5dS5j0a5p5S+u\n\t4/jBNBc7rbDZZl57ukM7dgY/hno3lK4xaieSRsHVPfiCgw5MpUmMl5pnomAlpNALHeH1\n\telyQ==","X-Gm-Message-State":"AOAM532BlXQNc5w3ZiE0teiN3tLbASoX8+CxlMYAqxXbsrkMYSaJJpyC\n\twDiRemjS+rY0VUOCn9JoWaNiswSitqc0iA==","X-Google-Smtp-Source":"ABdhPJxdkwSaN5QDpnLKbdxJhjMR0jSpjLXVyXYWoVeBpwAuabpvtY37dEPyoD+f6TErpE61Kfdqrw==","X-Received":"by 2002:a17:902:bd06:b0:143:aa76:faf0 with SMTP id\n\tp6-20020a170902bd0600b00143aa76faf0mr59842913pls.88.1638202461550; \n\tMon, 29 Nov 2021 08:14:21 -0800 (PST)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Nov 2021 21:43:36 +0530","Message-Id":"<20211129161336.1113408-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 EXPBUF as\n\tone 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":"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\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 | 30 ++++++++++++++++++++++++++++++\n src/v4l2/v4l2_camera_proxy.h   |  1 +\n 2 files changed, 31 insertions(+)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 3610e63cade3..f194e06345b7 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -624,6 +624,32 @@ 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+\n+\tif (!hasOwnership(file))\n+\t\treturn -EBUSY;\n+\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+\tmemset(arg->reserved, 0, sizeof(arg->reserved));\n+\n+\t/* \\todo honor the O_ACCMODE flags passed to this function */\n+\targ->fd = fcntl(vcam_->getBufferFd(arg->index).fd(),\n+\t\t\targ->flags & O_CLOEXEC ? F_DUPFD_CLOEXEC : F_DUPFD, 0);\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 +711,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 +782,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","v3"]}