drivers/staging/media/sunxi/cedrus/cedrus_h265.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/sunxi/cedrus/cedrus_h265.c- Extension
.c- Size
- 31948 bytes
- Lines
- 924
- Domain
- Driver Families
- Bucket
- drivers/staging
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/types.hmedia/videobuf2-dma-contig.hcedrus.hcedrus_hw.hcedrus_regs.h
Detected Declarations
struct cedrus_h265_sram_frame_infostruct cedrus_h265_sram_pred_weightfunction cedrus_h265_2bit_sizefunction cedrus_h265_irq_statusfunction cedrus_h265_irq_clearfunction cedrus_h265_irq_disablefunction cedrus_h265_sram_write_offsetfunction cedrus_h265_sram_write_datafunction cedrus_h265_frame_info_mv_col_buf_addrfunction cedrus_h265_frame_info_write_singlefunction cedrus_h265_frame_info_write_dpbfunction cedrus_h265_ref_pic_list_writefunction cedrus_h265_pred_weight_writefunction cedrus_h265_skip_bitsfunction cedrus_h265_show_bitsfunction cedrus_h265_write_scaling_listfunction cedrus_h265_is_low_delayfunction cedrus_h265_write_tilesfunction cedrus_h265_setupfunction cedrus_h265_startfunction cedrus_h265_stopfunction cedrus_h265_triggerfunction cedrus_h265_extra_cap_size
Annotated Snippet
struct cedrus_h265_sram_frame_info {
__le32 top_pic_order_cnt;
__le32 bottom_pic_order_cnt;
__le32 top_mv_col_buf_addr;
__le32 bottom_mv_col_buf_addr;
__le32 luma_addr;
__le32 chroma_addr;
} __packed;
struct cedrus_h265_sram_pred_weight {
__s8 delta_weight;
__s8 offset;
} __packed;
static unsigned int cedrus_h265_2bit_size(unsigned int width,
unsigned int height)
{
/*
* Vendor library additionally aligns width and height to 16,
* but all capture formats are already aligned to that anyway,
* so we can skip that here. All formats are also one form of
* YUV 4:2:0 or another, so we can safely assume multiplication
* factor of 1.5.
*/
return ALIGN(width / 4, 32) * height * 3 / 2;
}
static enum cedrus_irq_status cedrus_h265_irq_status(struct cedrus_ctx *ctx)
{
struct cedrus_dev *dev = ctx->dev;
u32 reg;
reg = cedrus_read(dev, VE_DEC_H265_STATUS);
reg &= VE_DEC_H265_STATUS_CHECK_MASK;
if (reg & VE_DEC_H265_STATUS_CHECK_ERROR ||
!(reg & VE_DEC_H265_STATUS_SUCCESS))
return CEDRUS_IRQ_ERROR;
return CEDRUS_IRQ_OK;
}
static void cedrus_h265_irq_clear(struct cedrus_ctx *ctx)
{
struct cedrus_dev *dev = ctx->dev;
cedrus_write(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_CHECK_MASK);
}
static void cedrus_h265_irq_disable(struct cedrus_ctx *ctx)
{
struct cedrus_dev *dev = ctx->dev;
u32 reg = cedrus_read(dev, VE_DEC_H265_CTRL);
reg &= ~VE_DEC_H265_CTRL_IRQ_MASK;
cedrus_write(dev, VE_DEC_H265_CTRL, reg);
}
static void cedrus_h265_sram_write_offset(struct cedrus_dev *dev, u32 offset)
{
cedrus_write(dev, VE_DEC_H265_SRAM_OFFSET, offset);
}
static void cedrus_h265_sram_write_data(struct cedrus_dev *dev, void *data,
unsigned int size)
{
u32 *word = data;
while (size >= sizeof(u32)) {
cedrus_write(dev, VE_DEC_H265_SRAM_DATA, *word++);
size -= sizeof(u32);
}
}
static inline dma_addr_t
cedrus_h265_frame_info_mv_col_buf_addr(struct vb2_buffer *buf,
unsigned int field)
{
struct cedrus_buffer *cedrus_buf = vb2_to_cedrus_buffer(buf);
return cedrus_buf->codec.h265.mv_col_buf_dma +
field * cedrus_buf->codec.h265.mv_col_buf_size / 2;
}
static void cedrus_h265_frame_info_write_single(struct cedrus_ctx *ctx,
unsigned int index,
bool field_pic,
u32 pic_order_cnt[],
struct vb2_buffer *buf)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/types.h`, `media/videobuf2-dma-contig.h`, `cedrus.h`, `cedrus_hw.h`, `cedrus_regs.h`.
- Detected declarations: `struct cedrus_h265_sram_frame_info`, `struct cedrus_h265_sram_pred_weight`, `function cedrus_h265_2bit_size`, `function cedrus_h265_irq_status`, `function cedrus_h265_irq_clear`, `function cedrus_h265_irq_disable`, `function cedrus_h265_sram_write_offset`, `function cedrus_h265_sram_write_data`, `function cedrus_h265_frame_info_mv_col_buf_addr`, `function cedrus_h265_frame_info_write_single`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.