v4l2_find_ne..._conditional(9)
π v4l2_find_ne..._conditional(9) β Kernel API Manual, but make it make sense π
okay so bestie, gather round, because we're talking about v4l2_find_nearest_size_conditional β¨ this is a Kernel API Manual page, and honestly? it's giving "small function, big job" energy π
πΈ NAME πΈ
v4l2_find_nearest_size_conditional β finds the nearest size among a discrete set of resolutions, all sitting pretty inside an array of a driver specific struct, and it can conditionally exclude certain modes π¦ (yes, "exclusion", we're being fancy)
β¨ SYNOPSIS β¨
v4l2_find_nearest_size_conditional (array , array_size , width_field ,
height_field , width , height , func , context );
π ARGUMENTS π
arrayβ a driver specific array of image sizes. it's the lineup, the roster, the main-character list πarray_sizeβ the length of that driver specific array of image sizes. gotta know how many we're working with, no cap π’width_fieldβ the name of the width field in the driver specific struct πheight_fieldβ the name of the height field in the driver specific struct π (sibling energy to width_field, we love a matching set)widthβ desired width. what you want πheightβ desired height. also what you want πfuncβ ignores a mode if it returns false. it's the vibe check function, basically πcontextβ context for the function. gotta pass it along so it knows what's up π«Ά
π₯ DESCRIPTION π₯
So what does it actually do? It finds the closest resolution β the one that minimizes the width and height differences between what you requested and the supported resolutions π« literally just "get me as close as you can, bestie".
Important detail, do NOT skip this: the size of the width and height fields in the driver specific must equal that of u32, i.e. four bytes. four. bytes. periodt π
And about func β it gets called for each mode considered, and a mode is ignored if func returns false for it. so it's a filter, a bouncer, a "you're not on the list" situation π
Returns the best match orNULLif the length of the array is zero. yeah, empty array = nothing to give, you getNULLπ
π SEE ALSO π
Kernel file ./include/media/v4l2-common.h, plus the whole friend group:
v4l2_ctrl_query_fill(9)enum v4l2_i2c_tuner_type(9)v4l2_i2c_new_subdev(9)v4l2_i2c_new_subdev_board(9)v4l2_i2c_subdev_set_name(9)v4l2_i2c_subdev_init(9)v4l2_i2c_subdev_addr(9)v4l2_i2c_tuner_addrs(9)v4l2_i2c_subdev_unregister(9)v4l2_spi_new_subdev(9)v4l2_spi_subdev_init(9)v4l2_spi_subdev_unregister(9)v4l_bound_align_image(9)v4l2_find_nearest_size(9)v4l2_g_parm_cap(9)v4l2_s_parm_cap(9)enum v4l2_pixel_encoding(9)struct v4l2_format_info(9)v4l2_get_link_freq(9)v4l2_get_active_data_lanes(9)v4l2_link_freq_to_bitmap(9)devm_v4l2_sensor_clk_get(9)devm_v4l2_sensor_clk_get_legacy(9)
and that's the whole page, bestie, you ate that ππ
cute little sign-off: this one lives in./include/media, datedOctober 2026, and it'sv4l2_find_ne..._conditional(9)β go forth and find your nearest size, icon π§β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms