From patchwork Tue May 17 14:33:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15932 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 19C11C3270 for ; Tue, 17 May 2022 14:34:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D6B965683; Tue, 17 May 2022 16:33:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652798039; bh=hFwAE5tnu4o6+UhDKvevxclNwmDGxiwsg/j5d7ZJsUo=; 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=2ooL/cPTWSCZWB+bi0lWpFeBmPULlEXi70rH8gYbzrym7yW1Lf3h9gURWKnWbX75Z uwgb64apGj2XxrRGkVhgvvnQN6u9l4qK6N2a5IivgGM5AIUztKdZg7UM6dZywxhKLN xHBSKv7XvJtip2cV8S7WBjRtnSN98mmOc2zitJg0axo/OMNmzuSoDuqcAL2jZI+8vI dtbupZ6CLrcOdl7hgsO+xElDPohQxoCYjkQTnjN8N1uWAOACp0ONABeMCIZ32563I/ JW+VkbyEDksh3r38utMzXdGr6uVKlMrgA4j5cXaukdKnKvAs0dofCDY76tzKjZJbd9 fN1z3KDDraTkQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A78866566B for ; Tue, 17 May 2022 16:33:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DNEfYBRs"; 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 22D678E6; Tue, 17 May 2022 16:33:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652798035; bh=hFwAE5tnu4o6+UhDKvevxclNwmDGxiwsg/j5d7ZJsUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNEfYBRscUID0CkpUu3wPCLShTmUwuBuUwifYKJGMyUs/gb1JQ4mB7c8Gritz8/q9 etzzVZraJfSnOkZOGKjMK/s4gPXYE0aJqaOj+wlcdtFz3QUrxOQj8Zjns42eEbvhAE kAHFXVPGfJjasJ9Uw+QEh6t8Pp2R/9DOSFTVHDow= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Tue, 17 May 2022 17:33:20 +0300 Message-Id: <20220517143325.71784-9-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> References: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 08/13] 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 Reviewed-by: Kieran Bingham --- src/py/cam/cam_kms.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/py/cam/cam_kms.py b/src/py/cam/cam_kms.py index ae6be277..f1844717 100644 --- a/src/py/cam/cam_kms.py +++ b/src/py/cam/cam_kms.py @@ -10,6 +10,7 @@ FMT_MAP = { 'YUYV': pykms.PixelFormat.YUYV, 'ARGB8888': pykms.PixelFormat.ARGB8888, 'XRGB8888': pykms.PixelFormat.XRGB8888, + 'NV12': pykms.PixelFormat.NV12, } @@ -133,10 +134,16 @@ class KMSRenderer: for fb in ctx['allocator'].buffers(stream): w, h = cfg.size - 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