From patchwork Mon May 16 14:10:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15919 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A1568C3270 for ; Mon, 16 May 2022 14:11:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4B3C96567F; Mon, 16 May 2022 16:11:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652710264; bh=8Xe5samNh0wR/IKpHFo8took51Ue1xe1NTyR2vXitCA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=zzlcmBCIbMTht+bCgFvF5rGp266/yGNjdegmISplyc2/q/IsokZHJVxjAkdNdpIVV 0XeH5GaU83/zc+GDOg38L4CoR5qdmSgpAl1f3YcvnHTHK8Or4A1XIkttp0AioDiVvW HB+P4OF7UM0RYpA8e/akOEoCHwlHP7qW1GNPKZVAhsUngWEqrg52yFGj41UyHfCXXb YUE/DtgHRZuaOkAIF+w7MpGeofQlnoeuKxXsuVr69tYTm4JxfuRDcPc2GFjJvEfoi4 rVrLXdDMg5S5iCy+j7rYdd/pPNo0HfP3KKTdlEz78ojCd/bAVT1FwhK0P/RVGsM2GZ g0Qaif19wLp5w== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A3EC26566E for ; Mon, 16 May 2022 16:10:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="n0DFthjM"; dkim-atps=neutral Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0D50A563; Mon, 16 May 2022 16:10:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652710254; bh=8Xe5samNh0wR/IKpHFo8took51Ue1xe1NTyR2vXitCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0DFthjMiKztvHaRzWH2ZrIpfrxROAd61AJbmd6vLusdVSgEN+cUK95ggInYpKdUq a66Zft7fQC8jX8A1Q+jvH8bC3donNwBjCpG6tHo5NvahkTjvk0a//4M81/8y8h9wzs 7XFBY5bAiLcCgyrJNFm1pHREZm6Y3itHBgvjKqkI= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Mon, 16 May 2022 17:10:21 +0300 Message-Id: <20220516141022.96327-14-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> References: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 13/14] py: cam_kms: support multiplanar formats 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-Patchwork-Original-From: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Support multiplanar formats in the kms renderer. Tested with RPi and NV12. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- src/py/cam/cam_kms.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/py/cam/cam_kms.py b/src/py/cam/cam_kms.py index da3dd4e0..90aac5f6 100644 --- a/src/py/cam/cam_kms.py +++ b/src/py/cam/cam_kms.py @@ -127,10 +127,16 @@ class KMSRenderer: for fb in ctx['allocator'].buffers(stream): w = cfg.size.width h = cfg.size.height - stride = cfg.stride - fd = fb.fd(0) + fds = [] + strides = [] + offsets = [] + for i in range(fb.num_planes): + fds.append(fb.fd(i)) + strides.append(cfg.stride) + offsets.append(fb.offset(i)) + drmfb = pykms.DmabufFramebuffer(self.card, w, h, fmt, - [fd], [stride], [0]) + fds, strides, offsets) self.cam_2_drm[fb] = drmfb idx += 1