/* * omap_voutlib.c * * Copyright (C) 2005-2010 Texas Instruments. * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. * * Based on the OMAP2 camera driver * Video-for-Linux (Version 2) camera capture driver for * the OMAP24xx camera controller. * * Author: Andy Lowe ([email protected]) * * Copyright (C) 2004 MontaVista Software, Inc. * Copyright (C) 2010 Texas Instruments. * */ #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/videodev2.h> #include <linux/dma-mapping.h> #include <video/omapfb_dss.h> #include "omap_voutlib.h" MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; /* Return the default overlay cropping rectangle in crop given the image * size in pix and the video display size in fbuf. The default * cropping rectangle is the largest rectangle no larger than the capture size * that will fit on the display. The default cropping rectangle is centered in * the image. All dimensions and offsets are rounded down to even numbers. */ void omap_vout_default_crop(struct v4l2_pix_format *pix, struct v4l2_framebuffer *fbuf, struct v4l2_rect *crop) { … } EXPORT_SYMBOL_GPL(…); /* Given a new render window in new_win, adjust the window to the * nearest supported configuration. The adjusted window parameters are * returned in new_win. * Returns zero if successful, or -EINVAL if the requested window is * impossible and cannot reasonably be adjusted. */ int omap_vout_try_window(struct v4l2_framebuffer *fbuf, struct v4l2_window *new_win) { … } EXPORT_SYMBOL_GPL(…); /* Given a new render window in new_win, adjust the window to the * nearest supported configuration. The image cropping window in crop * will also be adjusted if necessary. Preference is given to keeping the * window as close to the requested configuration as possible. If * successful, new_win, vout->win, and crop are updated. * Returns zero if successful, or -EINVAL if the requested preview window is * impossible and cannot reasonably be adjusted. */ int omap_vout_new_window(struct v4l2_rect *crop, struct v4l2_window *win, struct v4l2_framebuffer *fbuf, struct v4l2_window *new_win) { … } EXPORT_SYMBOL_GPL(…); /* 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) { … } EXPORT_SYMBOL_GPL(…); /* Given a new format in pix and fbuf, crop and win * structures are initialized to default values. crop * is initialized to the largest window size that will fit on the display. The * crop window is centered in the image. win is initialized to * the same size as crop and is centered on the display. * All sizes and offsets are constrained to be even numbers. */ void omap_vout_new_format(struct v4l2_pix_format *pix, struct v4l2_framebuffer *fbuf, struct v4l2_rect *crop, struct v4l2_window *win) { … } EXPORT_SYMBOL_GPL(…); /* * Allocate buffers */ unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr) { … } /* * Free buffers */ void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size) { … } bool omap_vout_dss_omap24xx(void) { … } bool omap_vout_dss_omap34xx(void) { … }