diff options
author | Liu Ying <b17645@freescale.com> | 2009-10-26 15:56:42 -0400 |
---|---|---|
committer | Liu Ying <b17645@freescale.com> | 2009-10-26 15:59:44 -0400 |
commit | eee5a08306df7d9b1f23f463c9e9439e04293b57 (patch) | |
tree | 68b959676944d055ad9e0da0d6a4ae720f9ce674 | |
parent | 88a02ec615300ef755f11388e089b54ce06ad65c (diff) |
ENGR00117261 V4L2 capture:CSI input cropping improvementrel_imx_2.6.28_5.1.02.6.28-mx35-200910261956
1) When using CSI->MEM to capture frames, the output frame resolution of
channel CSI->MEM should be the same with that of cropping input frame.
2) Enable to capture frames bigger than the cropped input frames.
Signed-off-by: Liu Ying <b17645@freescale.com>
-rw-r--r-- | drivers/media/video/mxc/capture/mxc_v4l2_capture.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c index 1852d702e505..bfc67e770fb0 100644 --- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c @@ -674,18 +674,8 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) */ if (strcmp(mxc_capture_inputs[cam->current_input].name, "CSI MEM") == 0) { - f->fmt.pix.width = cam->crop_bounds.width; - f->fmt.pix.height = cam->crop_bounds.height; - } - - /* Handle case where size requested is larger than cuurent - * camera setting. */ - if ((f->fmt.pix.width > cam->crop_bounds.width) - || (f->fmt.pix.height > cam->crop_bounds.height)) { - /* Need the logic here, calling vidioc_s_param if - * camera can change. */ - /* For the moment, just return an error. */ - return -EINVAL; + f->fmt.pix.width = cam->crop_current.width; + f->fmt.pix.height = cam->crop_current.height; } if (cam->rotation >= IPU_ROTATE_90_RIGHT) { @@ -700,10 +690,10 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) *width -= *width % 8; *height -= *height % 8; - if ((cam->crop_bounds.width / *width > 8) || - ((cam->crop_bounds.width / *width == 8) && - (cam->crop_bounds.width % *width))) { - *width = cam->crop_bounds.width / 8; + if ((cam->crop_current.width / *width > 8) || + ((cam->crop_current.width / *width == 8) && + (cam->crop_current.width % *width))) { + *width = cam->crop_current.width / 8; if (*width % 8) *width += 8 - *width % 8; pr_err("ERROR: v4l2 capture: width exceeds limit " @@ -711,10 +701,10 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) *width); } - if ((cam->crop_bounds.height / *height > 8) || - ((cam->crop_bounds.height / *height == 8) && - (cam->crop_bounds.height % *height))) { - *height = cam->crop_bounds.height / 8; + if ((cam->crop_current.height / *height > 8) || + ((cam->crop_current.height / *height == 8) && + (cam->crop_current.height % *height))) { + *height = cam->crop_current.height / 8; if (*height % 8) *height += 8 - *height % 8; pr_err("ERROR: v4l2 capture: height exceeds limit " @@ -1143,6 +1133,13 @@ static int mxc_v4l2_s_param(cam_data *cam, struct v4l2_streamparm *parm) cam->crop_bounds.width = cam_fmt.fmt.pix.width; cam->crop_bounds.height = cam_fmt.fmt.pix.height; + /* + * Set the default current cropped resolution to be the same with + * the cropping boundary. + */ + cam->crop_current.width = cam->crop_bounds.width; + cam->crop_current.height = cam->crop_bounds.height; + /* This essentially loses the data at the left and bottom of the image * giving a digital zoom image, if crop_current is less than the full * size of the image. */ |