{"id":21860,"url":"https://patchwork.libcamera.org/api/1.1/patches/21860/?format=json","web_url":"https://patchwork.libcamera.org/patch/21860/","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":"<20241108075039.2116460-2-chenghaoyang@chromium.org>","date":"2024-11-08T07:38:27","name":"[1/1] libcamera: Extend V4L2 videodevice to accept media request API","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d1e4bdb443da9b40b3d7228515eee26c53573f0c","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/1.1/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21860/mbox/","series":[{"id":4778,"url":"https://patchwork.libcamera.org/api/1.1/series/4778/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4778","date":"2024-11-08T07:38:26","name":"Extend V4L2 videodevice to accept media request API","version":1,"mbox":"https://patchwork.libcamera.org/series/4778/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21860/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21860/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 E8916BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Nov 2024 07:50:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A1C3760589;\n\tFri,  8 Nov 2024 08:50:47 +0100 (CET)","from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3EFC565486\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Nov 2024 08:50:46 +0100 (CET)","by mail-pl1-x62c.google.com with SMTP id\n\td9443c01a7336-207115e3056so18969835ad.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 07 Nov 2024 23:50:46 -0800 (PST)","from chenghaoyang-low.c.googlers.com.com\n\t(27.247.221.35.bc.googleusercontent.com. [35.221.247.27])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-21177e62dd4sm24343295ad.218.2024.11.07.23.50.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 07 Nov 2024 23:50:44 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"YX88PFgY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1731052244; x=1731657044;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=EVMZf6bLtabM0cvavXBD/DzwTkqLfLsoZvAUbTT4PTo=;\n\tb=YX88PFgYmsQJOCYu0RPz7CYWVoreROP+r7cvYuGc8M5d7sjRT+mDSZtoCwhGa6dvGC\n\tO2Nhs8huHhi7tNQTIk1xn3sljruj8ZFJifFLi31B3BBuCQbbUZkLkflUzVmKxBiHi6Gs\n\tcrSRYUC2RplRvq1c/Unk9kuEd+jJinVbXIm1k=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731052244; x=1731657044;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=EVMZf6bLtabM0cvavXBD/DzwTkqLfLsoZvAUbTT4PTo=;\n\tb=Mks6vUEdVghLx8OsLPQE0o68HNfVAsrOngucF60r4PpNP2Nk3YZ7qlXqE4mdEftWeF\n\tjWTUxkvgpEXBaecF3IuQnLRLYjaDYwPAKAkQpe8/RtDGCzqt940AQ2liLx1Ng9mAnZlx\n\t3bQIOEnmQR1evouH2gHa1p4026LAeSBccUGCNZihqCbPhQnXfYctwNwQiaiNQs7VHz2+\n\t7aODwiiXXP0rEOrrHELPuxwtPqtlHyeMM+NYmCy8EiwoxexkAuGAUfgr6UBBy3ALxn34\n\tYIApnIBWD8BLULEmxU/sf2O+vh9f0mwr0i2L+29i6R5gNgP2EZYRMvOPr59YBRCLXk6q\n\tXjBw==","X-Gm-Message-State":"AOJu0YziYesIBjyn5vQenVQ82KVJgolQ8vQBkVWFv42V2k0lJcyRZeTh\n\tCTOcTcyBq9cM/ZRfuk6DyN6ce7GCrW1A8y8m2VG/uMtC0sEF/V6ChXYIKODuHtI0qbeOa2rkc5n\n\tR8Q==","X-Google-Smtp-Source":"AGHT+IH6uHH8r2n1lVh5oQR8ah5K/LGkTzqyZko8CStIlsmYGxTcKi9vvBMiofzT7y746s3O3ak+uQ==","X-Received":"by 2002:a17:902:ecc2:b0:20c:c694:f6c6 with SMTP id\n\td9443c01a7336-211835bbc05mr21081035ad.49.1731052244387; \n\tThu, 07 Nov 2024 23:50:44 -0800 (PST)","From":"Harvey Yang <chenghaoyang@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Han-Lin Chen <hanlinchen@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>","Subject":"[PATCH 1/1] libcamera: Extend V4L2 videodevice to accept media\n\trequest API","Date":"Fri,  8 Nov 2024 07:38:27 +0000","Message-ID":"<20241108075039.2116460-2-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.47.0.277.g8800431eea-goog","In-Reply-To":"<20241108075039.2116460-1-chenghaoyang@chromium.org>","References":"<20241108075039.2116460-1-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Han-Lin Chen <hanlinchen@chromium.org>\n\nAdd request fd as an extra argument to V4L2 device queueBuffer.\nDefault to -1 for backward compatibility.\n\nIt's used to bind multiple buffers into the same request.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/internal/v4l2_videodevice.h | 2 +-\n src/libcamera/v4l2_videodevice.cpp            | 7 ++++++-\n 2 files changed, 7 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex f021c2a01..6e2b1e1f1 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -218,7 +218,7 @@ public:\n \tint importBuffers(unsigned int count);\n \tint releaseBuffers();\n \n-\tint queueBuffer(FrameBuffer *buffer);\n+\tint queueBuffer(FrameBuffer *buffer, int requestFd = -1);\n \tSignal<FrameBuffer *> bufferReady;\n \n \tint streamOn();\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 14eba0561..0c6ea086d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1604,6 +1604,7 @@ int V4L2VideoDevice::releaseBuffers()\n /**\n  * \\brief Queue a buffer to the video device\n  * \\param[in] buffer The buffer to be queued\n+ * \\param[in] requestFd The fd of the request to queue the buffer to\n  *\n  * For capture video devices the \\a buffer will be filled with data by the\n  * device. For output video devices the \\a buffer shall contain valid data and\n@@ -1618,7 +1619,7 @@ int V4L2VideoDevice::releaseBuffers()\n  *\n  * \\return 0 on success or a negative error code otherwise\n  */\n-int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n+int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer, int requestFd)\n {\n \tstruct v4l2_plane v4l2Planes[VIDEO_MAX_PLANES] = {};\n \tstruct v4l2_buffer buf = {};\n@@ -1647,6 +1648,10 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \tbuf.type = bufferType_;\n \tbuf.memory = memoryType_;\n \tbuf.field = V4L2_FIELD_NONE;\n+\tif (requestFd >= 0) {\n+\t\tbuf.flags |= V4L2_BUF_FLAG_REQUEST_FD;\n+\t\tbuf.request_fd = requestFd;\n+\t}\n \n \tbool multiPlanar = V4L2_TYPE_IS_MULTIPLANAR(buf.type);\n \tconst std::vector<FrameBuffer::Plane> &planes = buffer->planes();\n","prefixes":["1/1"]}