drivers/media/platform/ti/omap/omap_voutlib.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap/omap_voutlib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/omap/omap_voutlib.c- Extension
.c- Size
- 11038 bytes
- Lines
- 362
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/errno.hlinux/kernel.hlinux/types.hlinux/videodev2.hlinux/dma-mapping.hvideo/omapfb_dss.homap_voutlib.h
Detected Declarations
function omap_vout_default_cropfunction omap_vout_try_windowfunction omap_vout_new_windowfunction omap_vout_new_cropfunction omap_vout_new_formatfunction omap_vout_alloc_bufferfunction omap_vout_free_bufferfunction omap_vout_dss_omap24xxfunction omap_vout_dss_omap34xxexport omap_vout_default_cropexport omap_vout_try_windowexport omap_vout_new_windowexport omap_vout_new_cropexport omap_vout_new_format
Annotated Snippet
if (crop->width > 768) {
/* The OMAP2420 vertical resizing line buffer is 768
* pixels wide. If the cropped image is wider than
* 768 pixels then it cannot be vertically resized.
*/
if (crop->height != win->w.height)
crop->width = 768;
}
} else if (omap_vout_dss_omap34xx()) {
/* For 34xx limit is 8x to 1/4x scaling. */
if ((crop->height/win->w.height) >= 4)
crop->height = win->w.height * 4;
if ((crop->width/win->w.width) >= 4)
crop->width = win->w.width * 4;
}
return 0;
}
EXPORT_SYMBOL_GPL(omap_vout_new_window);
/* Given a new cropping rectangle in new_crop, adjust the cropping rectangle to
* the nearest supported configuration. The image render window in win will
* also be adjusted if necessary. The preview window is adjusted such that the
* horizontal and vertical rescaling ratios stay constant. If the render
* window would fall outside the display boundaries, the cropping rectangle
* will also be adjusted to maintain the rescaling ratios. If successful, crop
* and win are updated.
* Returns zero if successful, or -EINVAL if the requested cropping rectangle is
* impossible and cannot reasonably be adjusted.
*/
int omap_vout_new_crop(struct v4l2_pix_format *pix,
struct v4l2_rect *crop, struct v4l2_window *win,
struct v4l2_framebuffer *fbuf, const struct v4l2_rect *new_crop)
{
struct v4l2_rect try_crop;
unsigned long vresize, hresize;
/* make a working copy of the new_crop rectangle */
try_crop = *new_crop;
/* adjust the cropping rectangle so it fits in the image */
if (try_crop.left < 0) {
try_crop.width += try_crop.left;
try_crop.left = 0;
}
if (try_crop.top < 0) {
try_crop.height += try_crop.top;
try_crop.top = 0;
}
try_crop.width = (try_crop.width < pix->width) ?
try_crop.width : pix->width;
try_crop.height = (try_crop.height < pix->height) ?
try_crop.height : pix->height;
if (try_crop.left + try_crop.width > pix->width)
try_crop.width = pix->width - try_crop.left;
if (try_crop.top + try_crop.height > pix->height)
try_crop.height = pix->height - try_crop.top;
try_crop.width &= ~1;
try_crop.height &= ~1;
if (try_crop.width <= 0 || try_crop.height <= 0)
return -EINVAL;
if (omap_vout_dss_omap24xx()) {
if (try_crop.height != win->w.height) {
/* If we're resizing vertically, we can't support a
* crop width wider than 768 pixels.
*/
if (try_crop.width > 768)
try_crop.width = 768;
}
}
/* vertical resizing */
vresize = (1024 * try_crop.height) / win->w.height;
if (omap_vout_dss_omap24xx() && (vresize > 2048))
vresize = 2048;
else if (omap_vout_dss_omap34xx() && (vresize > 4096))
vresize = 4096;
win->w.height = ((1024 * try_crop.height) / vresize) & ~1;
if (win->w.height == 0)
win->w.height = 2;
if (win->w.height + win->w.top > fbuf->fmt.height) {
/* We made the preview window extend below the bottom of the
* display, so clip it to the display boundary and resize the
* cropping height to maintain the vertical resizing ratio.
*/
win->w.height = (fbuf->fmt.height - win->w.top) & ~1;
if (try_crop.height == 0)
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/kernel.h`, `linux/types.h`, `linux/videodev2.h`, `linux/dma-mapping.h`, `video/omapfb_dss.h`, `omap_voutlib.h`.
- Detected declarations: `function omap_vout_default_crop`, `function omap_vout_try_window`, `function omap_vout_new_window`, `function omap_vout_new_crop`, `function omap_vout_new_format`, `function omap_vout_alloc_buffer`, `function omap_vout_free_buffer`, `function omap_vout_dss_omap24xx`, `function omap_vout_dss_omap34xx`, `export omap_vout_default_crop`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.