Skip to content

Commit

Permalink
cam: fix dmabuf usage
Browse files Browse the repository at this point in the history
Signed-off-by: Tomi Valkeinen <[email protected]>
  • Loading branch information
tomba committed Jan 8, 2024
1 parent f2b358d commit b8e50d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@

if args.type == 'drm':
fds = [fb.fd(0) for fb in stream['fbs']]
cap.reserve_buffers_dmabuf(NUM_BUFS, fds)
cap.reserve_buffers_dmabuf(fds)
else:
cap.reserve_buffers(NUM_BUFS)

Expand Down Expand Up @@ -351,8 +351,10 @@ def handle_pageflip():

fb = stream['kms_old_fb']

payload_size = fb.size(0)
vbuf = v4l2.create_dmabuffer(fb.fd(0), stream['w'], stream['h'], stream['fourcc'], payload_size)
# XXX we should just track the vbufs in streams, instead of looking
# for the vbuf based on the drm fb
vbuf = next(vbuf for vbuf in cap.buffers if vbuf.fd == fb.fd(0))

cap.queue(vbuf)
stream['kms_old_fb'] = None

Expand Down

0 comments on commit b8e50d7

Please sign in to comment.