/* 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 * the window as close to the requested configuration as possible. If * successful, new_win, vout->win, and crop are updated. * Returns zero if succesful, 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) { int err; err = omap_vout_try_window(fbuf, new_win); if (err) return err; /* update our preview window */ win->w = new_win->w; win->field = new_win->field; win->chromakey = new_win->chromakey; if (cpu_is_omap24xx() || !machine_has_isp()) { /* adjust the cropping window to allow for resizing * limitations. 24xx allow 8x to 1/2x scaling. */ if ((crop->height/win->w.height) >= 2) { /* The maximum vertical downsizing ratio is 2:1 */ crop->height = win->w.height * 2; } if ((crop->width/win->w.width) >= 2) { /* The maximum horizontal downsizing ratio is 2:1 */ crop->width = win->w.width * 2; } 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 { /* adjust the cropping window to allow for resizing * limitations 34xx allow 8x to 1/8x scaling. */ if ((crop->height/win->w.height) >= 8) { /* The maximum vertical downsizing ratio is 8:1 */ crop->height = win->w.height * 8; } if ((crop->width/win->w.width) >= 8) { /* The maximum horizontal downsizing ratio is 8:1 */ crop->width = win->w.width * 8; } } return 0; }
/* 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 * the window as close to the requested configuration as possible. If * successful, new_win, vout->win, and crop are updated. * Returns zero if succesful, 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) { int err; err = omap_vout_try_window(fbuf, new_win); if (err) return err; /* update our preview window */ win->w = new_win->w; win->field = new_win->field; win->chromakey = new_win->chromakey; if (cpu_is_omap44xx()) //win->zorder = new_win->zorder; /* Adjust the cropping window to allow for resizing limitation */ omap_vout_init_max_downscale(); if (max_downscale > 0) { if ((crop->height/win->w.height) >= max_downscale) crop->height = win->w.height * max_downscale; if ((crop->width/win->w.width) >= max_downscale) crop->width = win->w.width * max_downscale; } if (cpu_is_omap24xx()) { 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; } } return 0; }