STRUCT HVA_CTX(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct hva_ctx(9) β€” from the Kernel API Manual, bestie

Okay so this is struct hva_ctx(9) and it lives in the Kernel API Manual, and it is literally the whole personality of one hva instance. Think of it as the group chat every encode job gets assigned to. 🌸


✨ NAME ✨

struct hva_ctx β€” the context of an hva instance. That's it, that's the vibe. 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

struct hva_ctx {
    struct hva_dev                  *hva_dev;
    struct v4l2_fh                  fh;
    struct v4l2_ctrl_handler        ctrl_handler;
    struct hva_controls             ctrls;
    u8 id;
    bool aborting;
    char name[100];
    struct work_struct              run_work;
    struct mutex                    lock;
    u32 flags;
    u32 frame_num;
    u32 stream_num;
    u32 max_stream_size;
    enum v4l2_colorspace            colorspace;
    enum v4l2_xfer_func             xfer_func;
    enum v4l2_ycbcr_encoding        ycbcr_enc;
    enum v4l2_quantization          quantization;
    struct hva_streaminfo           streaminfo;
    struct hva_frameinfo            frameinfo;
    struct hva_enc                  *enc;
    void *priv;
    bool hw_err;
    u32 encoded_frames;
    u32 sys_errors;
    u32 encode_errors;
    u32 frame_errors;
  #ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS;
    struct hva_ctx_dbg              dbg;
  #endif;
};

No cap, that's the entire struct, character for character. Do not touch it. πŸ’…


πŸ‘‘ Members πŸ‘‘

Every field, every one, because we don't do "and so on" in this house:

  • hva_dev β€” the device that this instance is associated with. Like, who's your sponsor basically.
  • fh β€” V4L2 file handle. Your little badge for the club. πŸŽ€
  • ctrl_handler β€” V4L2 controls handler.
  • ctrls β€” hva controls set.
  • id β€” instance identifier. The number that says you specifically. ✨
  • aborting β€” true if current job aborted. She's leaving the party early, respectfully.
  • name β€” instance name (debug purpose). For the debug girlies.
  • run_work β€” encode work. The actual labour. 😭
  • lock β€” mutex used to lock access of this context. One at a time, bestie, one at a time.
  • flags β€” validity of streaminfo and frameinfo fields. Says whether those two are even telling the truth.
  • frame_num β€” frame number.
  • stream_num β€” stream number.
  • max_stream_size β€” maximum size in bytes required for stream data. Big girl budget, in bytes. πŸ’€
  • colorspace β€” colorspace identifier.
  • xfer_func β€” transfer function identifier.
  • ycbcr_enc β€” Y'CbCr encoding identifier.
  • quantization β€” quantization identifier.
  • streaminfo β€” stream properties.
  • frameinfo β€” frame properties.
  • enc β€” current encoder. The main character of this whole thing tbh. πŸ‘‘
  • priv β€” private codec data for this instance, allocated by encoder open time.
  • hw_err β€” true if hardware error detected. 🚨
  • encoded_frames β€” number of encoded frames. The receipts.
  • sys_errors β€” number of system errors (memory, resource, pm...). Not her fault, the environment was toxic.
  • encode_errors β€” number of encoding errors (hw/driver errors).
  • frame_errors β€” number of frame errors (format, size, header...).
  • dbg β€” context debug info.
Note that dbg only even exists under #ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS; β€” so if debugfs wasn't configured in, that field is simply not invited to the function. πŸ™ˆ

🌈 SEE ALSO 🌈

Kernel file ./drivers/media/platform/st/sti/hva/hva.h struct hva_frameinfo(9), struct hva_streaminfo(9), struct hva_controls(9), struct hva_frame(9), struct hva_stream(9), struct hva_ctx_dbg(9), struct hva_dev_dbg(9), struct hva_dev(9), struct hva_enc(9)

Go read them, iykyk. πŸ¦‹


That's the whole page, bestie β€” love that for us. Sourced from ./drivers/media/platform/st/st..., dated October 2026, and yes the struct hva_ctx(9) girlies stay iconic. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from