mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-18 01:45:10 +03:00
py: cam_kms: Support multiplanar formats
Support multiplanar formats in the kms renderer. Tested with RPi and NV12. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
1384cedf50
commit
a4964c5df1
1 changed files with 10 additions and 3 deletions
|
@ -10,6 +10,7 @@ FMT_MAP = {
|
||||||
'YUYV': pykms.PixelFormat.YUYV,
|
'YUYV': pykms.PixelFormat.YUYV,
|
||||||
'ARGB8888': pykms.PixelFormat.ARGB8888,
|
'ARGB8888': pykms.PixelFormat.ARGB8888,
|
||||||
'XRGB8888': pykms.PixelFormat.XRGB8888,
|
'XRGB8888': pykms.PixelFormat.XRGB8888,
|
||||||
|
'NV12': pykms.PixelFormat.NV12,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,10 +134,16 @@ class KMSRenderer:
|
||||||
|
|
||||||
for fb in ctx['allocator'].buffers(stream):
|
for fb in ctx['allocator'].buffers(stream):
|
||||||
w, h = cfg.size
|
w, h = cfg.size
|
||||||
stride = cfg.stride
|
fds = []
|
||||||
fd = fb.fd(0)
|
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,
|
drmfb = pykms.DmabufFramebuffer(self.card, w, h, fmt,
|
||||||
[fd], [stride], [0])
|
fds, strides, offsets)
|
||||||
self.cam_2_drm[fb] = drmfb
|
self.cam_2_drm[fb] = drmfb
|
||||||
|
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue