From a4964c5df1ee6e2475186fe4fc5c7f7c08df1082 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 18 May 2022 16:13:20 +0300 Subject: py: cam_kms: Support multiplanar formats 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 Signed-off-by: Laurent Pinchart --- src/py/cam/cam_kms.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/py/cam') 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 -- cgit v1.2.1