From patchwork Tue Nov 26 23:36:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2365 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B6656136C for ; Wed, 27 Nov 2019 00:39:38 +0100 (CET) X-Halon-ID: 00df5d30-10a6-11ea-a0b9-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p54ac5865.dip0.t-ipconnect.de [84.172.88.101]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 00df5d30-10a6-11ea-a0b9-005056917f90; Wed, 27 Nov 2019 00:39:36 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Nov 2019 00:36:07 +0100 Message-Id: <20191126233620.1695316-18-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126233620.1695316-1-niklas.soderlund@ragnatech.se> References: <20191126233620.1695316-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 17/30] libcamera: v4l2_videodevice: Add support for multi plane output buffers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2019 23:39:38 -0000 When queuing an output buffer it was assumed it only had one plane. With the recent rework of the buffer code it's now trivial to add support multi plane output buffers, add support for it. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_videodevice.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 8f962c7e9d0c7d01..a05dd6a1f7d86eaa 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1014,7 +1014,17 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer) if (V4L2_TYPE_IS_OUTPUT(buf.type)) { const BufferInfo &info = buffer->info(); - buf.bytesused = info.planes()[0].bytesused; + if (multiPlanar) { + unsigned int nplane = 0; + for (const BufferInfo::Plane &plane : info.planes()) { + v4l2Planes[nplane].bytesused = plane.bytesused; + nplane++; + } + } else { + if (info.planes().size()) + buf.bytesused = info.planes()[0].bytesused; + } + buf.sequence = info.sequence(); buf.timestamp.tv_sec = info.timestamp() / 1000000000; buf.timestamp.tv_usec = (info.timestamp() / 1000) % 1000000;