drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c- Extension
.c- Size
- 42695 bytes
- Lines
- 1267
- 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/math.hlinux/string_choices.hmath_support.hgdc_device.hhmm.hisp.hia_css_binary.hia_css_debug.hia_css_util.hia_css_isp_param.hsh_css_internal.hsh_css_sp.hsh_css_firmware.hsh_css_defs.hsh_css_legacy.hatomisp_internal.hvf/vf_1.0/ia_css_vf.host.hsc/sc_1.0/ia_css_sc.host.hsdis/sdis_1.0/ia_css_sdis.host.hfixedbds/fixedbds_1.0/ia_css_fixedbds_param.hcamera/pipe/interface/ia_css_pipe_binarydesc.hassert_support.h
Detected Declarations
struct sh_css_shading_table_bayer_origin_compute_resultsfunction ia_css_binary_dvs_envfunction ia_css_binary_internal_resfunction sh_css_binary_common_grid_infofunction ia_css_binary_dvs_grid_infofunction ia_css_binary_dvs_stat_grid_infofunction ia_css_binary_3a_grid_infofunction binary_init_pc_histogramfunction binary_init_metricsfunction binary_supports_output_formatfunction binary_supports_vf_formatfunction supports_bds_factorfunction binary_init_infofunction ia_css_binary_init_infosfunction ia_css_binary_uninitfunction binary_grid_deci_factor_log2function binary_in_frame_padded_widthfunction ia_css_binary_fill_infofunction ia_css_binary_findfunction ia_css_binary_max_vf_widthfunction ia_css_binary_destroy_isp_parametersfunction ia_css_binary_get_isp_binaries
Annotated Snippet
struct sh_css_shading_table_bayer_origin_compute_results {
u32 bayer_scale_hor_ratio_in; /* Horizontal ratio (in) of bayer scaling. */
u32 bayer_scale_hor_ratio_out; /* Horizontal ratio (out) of bayer scaling. */
u32 bayer_scale_ver_ratio_in; /* Vertical ratio (in) of bayer scaling. */
u32 bayer_scale_ver_ratio_out; /* Vertical ratio (out) of bayer scaling. */
u32 sc_bayer_origin_x_bqs_on_shading_table; /* X coordinate (in bqs) of bayer origin on shading table. */
u32 sc_bayer_origin_y_bqs_on_shading_table; /* Y coordinate (in bqs) of bayer origin on shading table. */
};
/* Get the requirements for the shading correction. */
static int
ia_css_binary_compute_shading_table_bayer_origin(
const struct ia_css_binary *binary, /* [in] */
unsigned int required_bds_factor, /* [in] */
const struct ia_css_stream_config *stream_config, /* [in] */
struct sh_css_shading_table_bayer_origin_compute_results *res) /* [out] */
{
int err;
/* Rational fraction of the fixed bayer downscaling factor. */
struct u32_fract bds;
/* Left padding set by InputFormatter. */
unsigned int left_padding_bqs; /* in bqs */
/* Flag for the NEED_BDS_FACTOR_2_00 macro defined in isp kernels. */
unsigned int need_bds_factor_2_00;
/* Left padding adjusted inside the isp. */
unsigned int left_padding_adjusted_bqs; /* in bqs */
/* Bad pixels caused by filters.
NxN-filter (before/after bayer scaling) moves the image position
to right/bottom directions by a few pixels.
It causes bad pixels at left/top sides,
and effective bayer size decreases. */
unsigned int bad_bqs_on_left_before_bs; /* in bqs */
unsigned int bad_bqs_on_left_after_bs; /* in bqs */
unsigned int bad_bqs_on_top_before_bs; /* in bqs */
unsigned int bad_bqs_on_top_after_bs; /* in bqs */
/* Get the rational fraction of bayer downscaling factor. */
err = sh_css_bds_factor_get_fract(required_bds_factor, &bds);
if (err)
return err;
/* Set the left padding set by InputFormatter. (ifmtr.c) */
if (stream_config->left_padding == -1)
left_padding_bqs = _ISP_BQS(binary->left_padding);
else
left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS
- _ISP_BQS(stream_config->left_padding));
/* Set the left padding adjusted inside the isp.
When bds_factor 2.00 is needed, some padding is added to left_padding
inside the isp, before bayer downscaling. (raw.isp.c)
(Hopefully, left_crop/left_padding/top_crop should be defined in css
appropriately, depending on bds_factor.)
*/
need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors &
(PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) |
PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0);
if (need_bds_factor_2_00 && binary->info->sp.pipeline.left_cropping > 0)
left_padding_adjusted_bqs = left_padding_bqs + ISP_VEC_NELEMS;
else
left_padding_adjusted_bqs = left_padding_bqs;
/* Currently, the bad pixel caused by filters before bayer scaling
is NOT considered, because the bad pixel is subtle.
When some large filter is used in the future,
we need to consider the bad pixel.
Currently, when bds_factor isn't 1.00, 3x3 anti-alias filter is applied
to each color plane(Gr/R/B/Gb) before bayer downscaling.
This filter moves each color plane to right/bottom directions
by 1 pixel at the most, depending on downscaling factor.
*/
bad_bqs_on_left_before_bs = 0;
bad_bqs_on_top_before_bs = 0;
/* Currently, the bad pixel caused by filters after bayer scaling
is NOT considered, because the bad pixel is subtle.
When some large filter is used in the future,
Annotation
- Immediate include surface: `linux/math.h`, `linux/string_choices.h`, `math_support.h`, `gdc_device.h`, `hmm.h`, `isp.h`, `ia_css_binary.h`, `ia_css_debug.h`.
- Detected declarations: `struct sh_css_shading_table_bayer_origin_compute_results`, `function ia_css_binary_dvs_env`, `function ia_css_binary_internal_res`, `function sh_css_binary_common_grid_info`, `function ia_css_binary_dvs_grid_info`, `function ia_css_binary_dvs_stat_grid_info`, `function ia_css_binary_3a_grid_info`, `function binary_init_pc_histogram`, `function binary_init_metrics`, `function binary_supports_output_format`.
- 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.