drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c- Extension
.c- Size
- 21991 bytes
- Lines
- 741
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/math.hassert_support.hatomisp_internal.hhmm.hia_css_debug.hia_css_frame.hisp.hsh_css_internal.h
Detected Declarations
function ia_css_frame_allocate_from_infofunction ia_css_frame_allocatefunction ia_css_frame_freefunction ia_css_frame_check_infofunction ia_css_frame_init_planesfunction ia_css_frame_pad_widthfunction ia_css_frame_info_set_widthfunction ia_css_frame_info_set_formatfunction ia_css_frame_info_initfunction ia_css_frame_free_multiplefunction ia_css_frame_allocate_with_buffer_sizefunction ia_css_frame_info_is_same_resolutionfunction ia_css_frame_is_same_typefunction ia_css_dma_configure_from_infofunction frame_init_planefunction frame_init_single_planefunction frame_init_raw_single_planefunction frame_init_nv_planesfunction frame_init_yuv_planesfunction frame_init_rgb_planesfunction frame_init_qplane6_planesfunction frame_allocate_buffer_datafunction frame_allocate_with_datafunction ia_css_elems_bytes_from_infofunction ia_css_frame_info_to_frame_sp_infofunction ia_css_resolution_to_sp_resolutionfunction ia_css_frame_init_from_info
Annotated Snippet
if (frames_array[i]) {
ia_css_frame_free(frames_array[i]);
frames_array[i] = NULL;
}
}
}
int ia_css_frame_allocate_with_buffer_size(struct ia_css_frame **frame,
const unsigned int buffer_size_bytes)
{
/* AM: Body copied from frame_allocate_with_data(). */
int err;
struct ia_css_frame *me = frame_create(0, 0,
IA_CSS_FRAME_FORMAT_NUM,/* Not valid format yet */
0, 0, false);
if (!me)
return -ENOMEM;
/* Get the data size */
me->data_bytes = buffer_size_bytes;
err = frame_allocate_buffer_data(me);
if (err) {
kvfree(me);
me = NULL;
}
*frame = me;
return err;
}
bool ia_css_frame_info_is_same_resolution(
const struct ia_css_frame_info *info_a,
const struct ia_css_frame_info *info_b)
{
if (!info_a || !info_b)
return false;
return (info_a->res.width == info_b->res.width) &&
(info_a->res.height == info_b->res.height);
}
bool ia_css_frame_is_same_type(const struct ia_css_frame *frame_a,
const struct ia_css_frame *frame_b)
{
bool is_equal = false;
const struct ia_css_frame_info *info_a = &frame_a->frame_info;
const struct ia_css_frame_info *info_b = &frame_b->frame_info;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_is_same_type() enter:\n");
if (!info_a || !info_b)
return false;
if (info_a->format != info_b->format)
return false;
if (info_a->padded_width != info_b->padded_width)
return false;
is_equal = ia_css_frame_info_is_same_resolution(info_a, info_b);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_frame_is_same_type() leave:\n");
return is_equal;
}
int ia_css_dma_configure_from_info(struct dma_port_config *config,
const struct ia_css_frame_info *info)
{
unsigned int is_raw_packed = info->format == IA_CSS_FRAME_FORMAT_RAW_PACKED;
unsigned int bits_per_pixel = is_raw_packed ? info->raw_bit_depth :
ia_css_elems_bytes_from_info(info) * 8;
unsigned int pix_per_ddrword = HIVE_ISP_DDR_WORD_BITS / bits_per_pixel;
unsigned int words_per_line = CEIL_DIV(info->padded_width, pix_per_ddrword);
unsigned int elems_b = pix_per_ddrword;
config->stride = HIVE_ISP_DDR_WORD_BYTES * words_per_line;
config->elems = (uint8_t)elems_b;
config->width = (uint16_t)info->res.width;
config->crop = 0;
if (config->width > info->padded_width) {
dev_err(atomisp_dev, "internal error: padded_width is too small!\n");
return -EINVAL;
}
return 0;
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/math.h`, `assert_support.h`, `atomisp_internal.h`, `hmm.h`, `ia_css_debug.h`, `ia_css_frame.h`, `isp.h`.
- Detected declarations: `function ia_css_frame_allocate_from_info`, `function ia_css_frame_allocate`, `function ia_css_frame_free`, `function ia_css_frame_check_info`, `function ia_css_frame_init_planes`, `function ia_css_frame_pad_width`, `function ia_css_frame_info_set_width`, `function ia_css_frame_info_set_format`, `function ia_css_frame_info_init`, `function ia_css_frame_free_multiple`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
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.