STRUCT TEGRA_VI_CHANNEL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct tegra_vi_channel(9) πŸ’–

okay so bestie, we're deep in the Kernel API Manual right now and today's main character is the one and only struct tegra_vi_channel β€” the Tegra video channel πŸŽ€ like literally the whole vibe of a video channel on Tegra, all wrapped up in one struct. no cap, she's a big one. let's get into it ✨


🌸 NAME 🌸

struct tegra_vi_channel β€” Tegra video channel πŸ’…


✨ SYNOPSIS ✨

struct tegra_vi_channel {
    struct list_head list;
    struct video_device video;
    struct mutex video_lock;
    struct media_pad pad;
    struct tegra_vi *vi;
    struct host1x_syncpt *frame_start_sp[GANG_PORTS_MAX];
    struct host1x_syncpt *mw_ack_sp[GANG_PORTS_MAX];
    spinlock_t sp_incr_lock[GANG_PORTS_MAX];
    struct task_struct *kthread_start_capture;
    wait_queue_head_t start_wait;
    struct task_struct *kthread_finish_capture;
    wait_queue_head_t done_wait;
    struct v4l2_pix_format format;
    const struct tegra_video_format *fmtinfo;
    struct vb2_queue queue;
    u32 sequence;
    unsigned int addr_offset_u;
    unsigned int addr_offset_v;
    unsigned int start_offset;
    unsigned int start_offset_u;
    unsigned int start_offset_v;
    struct list_head capture;
    spinlock_t start_lock;
    struct list_head done;
    spinlock_t done_lock;
    unsigned char portnos[GANG_PORTS_MAX];
    u8 totalports;
    u8 numgangports;
    struct device_node *of_node;
    struct v4l2_ctrl_handler ctrl_handler;
    unsigned int syncpt_timeout_retry;
    unsigned long fmts_bitmap[BITS_TO_LONGS( MAX_FORMAT_NUM)];
    unsigned long tpg_fmts_bitmap[BITS_TO_LONGS( MAX_FORMAT_NUM)];
    enum tegra_vi_pg_mode pg_mode;
    struct v4l2_async_notifier notifier;
    bool hflip:1;
    bool vflip:1;
 };

like, she's got range πŸ¦‹ and honestly? obsessed.


πŸ‘‘ Members πŸ‘‘

okay this is the part where we go member by member, and there are a LOT of them, so buckle up bestie 🫢

  • list β€” list head for this entry. iconic little linked-list behavior, we love to see it ✨
  • video β€” the V4L2 video device associated with the video channel. this is her public-facing era πŸ’…
  • video_lock β€” protects the format and queue fields. do not touch those without her, fr fr πŸ”’
  • pad β€” media pad for the video device entity. media-pad representation, very main character πŸŽ€
  • vi β€” the Tegra video input device structure. her parent, basically πŸ’–
  • frame_start_sp β€” host1x syncpoint pointer to synchronize the programmed capture start condition with hardware frame start events through host1x syncpoint counters. (Tegra210) ⭐
  • mw_ack_sp β€” host1x syncpoint pointer to synchronize the programmed memory write ack trigger condition with hardware memory write done at end of frame through host1x syncpoint counters (On Tegra20 used for the OUT_1 syncpt). πŸ”₯
  • sp_incr_lock β€” protects cpu syncpoint increment. tiny lock, big job πŸ’€
  • kthread_start_capture β€” kthread to start capture of single frame when vb buffer is available. This thread programs VI CSI hardware for single frame capture and waits for frame start event from the hardware. On receiving frame start event, it wakes up kthread_finish_capture thread to wait for finishing frame data write to the memory. In case of missing frame start event, this thread returns buffer back to vb with VB2_BUF_STATE_ERROR. 😭 she's got responsibilities
  • start_wait β€” waitqueue for starting frame capture when buffer is available. she waits, she slays πŸ¦‹
  • kthread_finish_capture β€” kthread to finish the buffer capture and return to. This thread is woken up by kthread_start_capture on receiving frame start event from the hardware and this thread waits for MW_ACK_DONE event which indicates completion of writing frame data to the memory. On receiving MW_ACK_DONE event, buffer is returned back to vb with VB2_BUF_STATE_DONE and in case of missing MW_ACK_DONE event, buffer is returned back to vb with VB2_BUF_STATE_ERROR. the relay race of the kernel, no cap πŸƒβ€β™€οΈ
  • done_wait β€” waitqueue for finishing capture data writes to memory. the "are we done yet" queue πŸ’œ
  • format β€” active V4L2 pixel format. the current look ✨
  • fmtinfo β€” format information corresponding to the active format. her info card πŸŽ€
  • queue β€” vb2 buffers queue. buffer queue behavior 🌈
  • sequence β€” V4L2 buffers sequence number. counting the vibes, one buffer at a time πŸ”’
  • addr_offset_u β€” U plane base address, relative to buffer base address (only for planar). πŸ’œ
  • addr_offset_v β€” V plane base address, relative to buffer base address (only for planar). πŸ’œ
  • start_offset β€” 1st Y byte to write, relative to buffer base address (for H/V flip). πŸ™ˆ
  • start_offset_u β€” 1st U byte to write, relative to buffer base address (for H/V flip). πŸ™ˆ
  • start_offset_v β€” 1st V byte to write, relative to buffer base address (for H/V flip). πŸ™ˆ
  • capture β€” list of queued buffers for capture. the queue of dreams πŸ“
  • start_lock β€” protects the capture queued list. πŸŽ€
  • done β€” list of capture done queued buffers. the finished pile ✨
  • done_lock β€” protects the capture done queue list. πŸŽ€
  • portnos β€” VI channel port numbers. πŸ”’
  • totalports β€” total number of ports used for this channel. πŸ”’
  • numgangports β€” number of ports combined together as a gang for capture. gang gang 🫢πŸ”₯
  • of_node β€” device node of VI channel. device-tree era 🌸
  • ctrl_handler β€” V4L2 control handler of this video channel. she's got controls πŸ’…
  • syncpt_timeout_retry β€” syncpt timeout retry count for the capture. try again energy 😭
  • fmts_bitmap β€” a bitmap for supported formats matching v4l2 subdev formats. ⭐
  • tpg_fmts_bitmap β€” a bitmap for supported TPG formats. ⭐
  • pg_mode β€” test pattern generator mode (disabled/direct/patch). three moods, honestly πŸ’€
  • notifier β€” V4L2 asynchronous subdevs notifier. she notifies ✨
  • hflip β€” Horizontal flip is enabled. πŸ¦‹
  • vflip β€” Vertical flip is enabled. πŸ¦‹

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/staging/media/tegra-video/vi.h struct tegra_vi_ops(9), struct tegra_vi_soc(9), struct tegra_vi(9), struct tegra_channel_buffer(9), struct tegra_video_format(9)

iykyk, go read those next bestie, they're all linked in the same little kernel friend group πŸ«ΆπŸ’–


and that's the whole page, periodt πŸ’… this was brought to you by ./drivers/staging/media/tegra-... and the very cute month of October 2026 β€” stan the kernel docs, they ate πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from