aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:50:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:17 -0400
commit6a6c8786725c0b3d143674effa8b772f47b1c189 (patch)
tree8bb76c5dcbd579f13e876bd1a0bb56bee4bcebdd /Documentation
parent0166b74374cae3fa8bff0caef726a3d960a9a50a (diff)
V4L/DVB (12534): soc-camera: V4L2 API compliant scaling (S_FMT) and cropping (S_CROP)
The initial soc-camera scaling and cropping implementation turned out to be incompliant with the V4L2 API, e.g., it expected the user to specify cropping in output window pixels, instead of input window pixels. This patch converts the soc-camera core and all drivers to comply with the standard. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/video4linux/soc-camera.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt
index 178ef3c5e579..3f87c7da4ca2 100644
--- a/Documentation/video4linux/soc-camera.txt
+++ b/Documentation/video4linux/soc-camera.txt
@@ -116,5 +116,45 @@ functionality.
116struct soc_camera_device also links to an array of struct soc_camera_data_format, 116struct soc_camera_device also links to an array of struct soc_camera_data_format,
117listing pixel formats, supported by the camera. 117listing pixel formats, supported by the camera.
118 118
119VIDIOC_S_CROP and VIDIOC_S_FMT behaviour
120----------------------------------------
121
122Above user ioctls modify image geometry as follows:
123
124VIDIOC_S_CROP: sets location and sizes of the sensor window. Unit is one sensor
125pixel. Changing sensor window sizes preserves any scaling factors, therefore
126user window sizes change as well.
127
128VIDIOC_S_FMT: sets user window. Should preserve previously set sensor window as
129much as possible by modifying scaling factors. If the sensor window cannot be
130preserved precisely, it may be changed too.
131
132In soc-camera there are two locations, where scaling and cropping can taks
133place: in the camera driver and in the host driver. User ioctls are first passed
134to the host driver, which then generally passes them down to the camera driver.
135It is more efficient to perform scaling and cropping in the camera driver to
136save camera bus bandwidth and maximise the framerate. However, if the camera
137driver failed to set the required parameters with sufficient precision, the host
138driver may decide to also use its own scaling and cropping to fulfill the user's
139request.
140
141Camera drivers are interfaced to the soc-camera core and to host drivers over
142the v4l2-subdev API, which is completely functional, it doesn't pass any data.
143Therefore all camera drivers shall reply to .g_fmt() requests with their current
144output geometry. This is necessary to correctly configure the camera bus.
145.s_fmt() and .try_fmt() have to be implemented too. Sensor window and scaling
146factors have to be maintained by camera drivers internally. According to the
147V4L2 API all capture drivers must support the VIDIOC_CROPCAP ioctl, hence we
148rely on camera drivers implementing .cropcap(). If the camera driver does not
149support cropping, it may choose to not implement .s_crop(), but to enable
150cropping support by the camera host driver at least the .g_crop method must be
151implemented.
152
153User window geometry is kept in .user_width and .user_height fields in struct
154soc_camera_device and used by the soc-camera core and host drivers. The core
155updates these fields upon successful completion of a .s_fmt() call, but if these
156fields change elsewhere, e.g., during .s_crop() processing, the host driver is
157responsible for updating them.
158
119-- 159--
120Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> 160Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>