vb2_core_qbuf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vb2_core_qbuf(9) πŸ’–

okay bestie, welcome to the Kernel API Manual entry for vb2_core_qbuf β€” yes that's the full name, the manual page title up top literally says vb2_core_qbuf(9) twice and we're not gonna pretend otherwise πŸŽ€


✨ NAME ✨

vb2_core_qbuf β€” Queue a buffer from userspace πŸ¦‹


✨ SYNOPSIS ✨

int vb2_core_qbuf (struct vb2_queue *q , struct vb2_buffer *vb , void *pb , struct media_request *req );

🌸 ARGUMENTS 🌸

  • q β€” pointer to struct vb2_queue with the videobuf2 queue. the whole vibe container, basically πŸ’…
  • vb β€” pointer to struct vb2_buffer. the buffer in question, main character energy πŸ‘‘
  • pb β€” the buffer structure passed from userspace to the v4l2_ioctl_ops->vidioc_qbuf handler in your driver. so this is the thing userspace literally handed over 🫢
  • req β€” pointer to struct media_request, and heads up: it may be NULL. no cap, NULL is allowed here πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

This is the Videobuf2 core helper that implements the VIDIOC_QBUF operation. It gets called internally by VB2 through an API-specific handler, like videobuf2-v4l2.h β€” iykyk, it's an inside job ✨

Here's the tea, this function does these things:

  1. If req is non-NULL, then the buffer will be bound to this media request and it returns. The buffer will be prepared and queued to the driver (i.e. the next two steps) when the request itself is queued. ⭐ so it clocks out early and finishes the job later, iconic behaviour tbh
  2. if necessary, calls the vb2_ops->buf_prepare callback in the driver (if provided), in which driver-specific buffer initialization can be performed. πŸŽ€ this is where your driver gets to do its little pre-game routine
  3. if streaming is on, queues the buffer in the driver by the means of the vb2_ops->buf_queue callback for processing. πŸ”₯ and now it's actually off to get processed

⭐ RETURN ⭐

returns zero on success; an error code otherwise. that's it, that's the whole personality check πŸ’€

πŸ’‘ reminder: zero = slay, anything else = not slay. no in-between.

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/media/videobuf2-core.h and also these besties:


and that's the whole page, bestie!! mwah πŸ’‹ this one came from ./include/media, version dated October 2026, and the page you just read is vb2_core_qbuf(9). go queue a buffer, u got this πŸ§šπŸ’œ

πŸ“¦ where this page comes from