V4L2 and V4L2 subdev selection target and flag changes
Subsystems (2)
v4 cover V4L2 and V4L2 subdev selection target and flag changes
Hi,
Compared to the previous version of the patchset, I've fixed a few spelling errors, changed X/O to tell whether a target or a flag is valid on an interface to more clear Yes/No. There's also a new patch to V4L2 subdev selection API documentation fixing conflicting definition of the KEEP_CONFIG flag.
The resulting HTML documentation is available here (same location as last time):
<URL:http://www.retiisi.org.uk/v4l2/tmp/media_api5/>
Kind regards,
Signature · 2 lines
Sakari Ailus [email protected]
PATCH v4 1/7 V4L: Remove "_ACTIVE" from the selection target name definitions
From: Sylwester Nawrocki <[email protected]>
This patch drops the _ACTIVE part from the selection target names as a prerequisite to unify the selection target names across the subdev and regular video node API.
The meaning of V4L2_SEL_TGT_*_ACTIVE and V4L2_SUBDEV_SEL_TGT_*_ACTUAL selection targets is logically the same. Different names add to confusion where both APIs are used in a single driver or an application. For some system configurations different names may lead to interoperability issues.
For backwards compatibility V4L2_SEL_TGT_CROP_ACTIVE and V4L2_SEL_TGT_COMPOSE_ACTIVE are defined as aliases to V4L2_SEL_TGT_CROP and V4L2_SEL_TGT_COMPOSE. These aliases will be removed after deprecation period, according to Documentation/feature-removal-schedule.txt.
--- Documentation/DocBook/media/v4l/selection-api.xml | 24 ++++++++++---------- .../DocBook/media/v4l/vidioc-g-selection.xml | 15 ++++++----- drivers/media/video/s5p-fimc/fimc-capture.c | 14 +++++----- drivers/media/video/s5p-fimc/fimc-lite.c | 4 +- drivers/media/video/s5p-jpeg/jpeg-core.c | 4 +- drivers/media/video/s5p-tv/mixer_video.c | 8 +++--- drivers/media/video/v4l2-ioctl.c | 8 +++--- include/linux/videodev2.h | 8 +++++- 8 files changed, 45 insertions(+), 40 deletions(-)
Documentation/DocBook/media/v4l/selection-api.xml +12 -12
@@ -91,7 +91,7 @@ top/left corner at position <constant> (0,0) </constant>. The rectangle's coordinates are expressed in pixels.</para> <para>The top left corner, width and height of the source rectangle, that is -the area actually sampled, is given by the <constant> V4L2_SEL_TGT_CROP_ACTIVE +the area actually sampled, is given by the <constant> V4L2_SEL_TGT_CROP </constant> target. It uses the same coordinate system as <constant> V4L2_SEL_TGT_CROP_BOUNDS </constant>. The active cropping area must lie completely inside the capture boundaries. The driver may further adjust the
@@ -111,7 +111,7 @@ height are equal to the image size set by <constant> VIDIOC_S_FMT </constant>. </para> <para>The part of a buffer into which the image is inserted by the hardware is -controlled by the <constant> V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> target. +controlled by the <constant> V4L2_SEL_TGT_COMPOSE </constant> target. The rectangle's coordinates are also expressed in the same coordinate system as the bounds rectangle. The composing rectangle must lie completely inside bounds rectangle. The driver must adjust the composing rectangle to fit to the
@@ -125,7 +125,7 @@ bounding rectangle.</para> <para>The part of a buffer that is modified by the hardware is given by <constant> V4L2_SEL_TGT_COMPOSE_PADDED </constant>. It contains all pixels -defined using <constant> V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> plus all +defined using <constant> V4L2_SEL_TGT_COMPOSE </constant> plus all padding data modified by hardware during insertion process. All pixels outside this rectangle <emphasis>must not</emphasis> be changed by the hardware. The content of pixels that lie inside the padded area but outside active area is
@@ -153,7 +153,7 @@ specified using <constant> VIDIOC_S_FMT </constant> ioctl.</para> <para>The top left corner, width and height of the source rectangle, that is the area from which image date are processed by the hardware, is given by the -<constant> V4L2_SEL_TGT_CROP_ACTIVE </constant>. Its coordinates are expressed +<constant> V4L2_SEL_TGT_CROP </constant>. Its coordinates are expressed in in the same coordinate system as the bounds rectangle. The active cropping area must lie completely inside the crop boundaries and the driver may further adjust the requested size and/or position according to hardware
@@ -165,7 +165,7 @@ bounding rectangle.</para> <para>The part of a video signal or graphics display where the image is inserted by the hardware is controlled by <constant> -V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> target. The rectangle's coordinates +V4L2_SEL_TGT_COMPOSE </constant> target. The rectangle's coordinates are expressed in pixels. The composing rectangle must lie completely inside the bounds rectangle. The driver must adjust the area to fit to the bounding limits. Moreover, the driver can perform other adjustments according to
@@ -184,7 +184,7 @@ such a padded area is driver-dependent feature not covered by this document. Driver developers are encouraged to keep padded rectangle equal to active one. The padded target is accessed by the <constant> V4L2_SEL_TGT_COMPOSE_PADDED </constant> identifier. It must contain all pixels from the <constant> -V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> target.</para> +V4L2_SEL_TGT_COMPOSE </constant> target.</para> </section>
@@ -193,8 +193,8 @@ V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> target.</para> <title>Scaling control</title> <para>An application can detect if scaling is performed by comparing the width -and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP_ACTIVE -</constant> and <constant> V4L2_SEL_TGT_COMPOSE_ACTIVE </constant> targets. If +and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP +</constant> and <constant> V4L2_SEL_TGT_COMPOSE </constant> targets. If these are not equal then the scaling is applied. The application can compute the scaling ratios using these values.</para>
@@ -252,7 +252,7 @@ area)</para> ret = ioctl(fd, &VIDIOC-G-SELECTION;, &sel); if (ret) exit(-1); - sel.target = V4L2_SEL_TGT_CROP_ACTIVE; + sel.target = V4L2_SEL_TGT_CROP; ret = ioctl(fd, &VIDIOC-S-SELECTION;, &sel); if (ret) exit(-1);
@@ -281,7 +281,7 @@ area)</para> r.left = sel.r.width / 4; r.top = sel.r.height / 4; sel.r = r; - sel.target = V4L2_SEL_TGT_COMPOSE_ACTIVE; + sel.target = V4L2_SEL_TGT_COMPOSE; sel.flags = V4L2_SEL_FLAG_LE; ret = ioctl(fd, &VIDIOC-S-SELECTION;, &sel); if (ret)
@@ -298,11 +298,11 @@ V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> for other devices</para> &v4l2-selection; compose = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, - .target = V4L2_SEL_TGT_COMPOSE_ACTIVE, + .target = V4L2_SEL_TGT_COMPOSE, }; &v4l2-selection; crop = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, - .target = V4L2_SEL_TGT_CROP_ACTIVE, + .target = V4L2_SEL_TGT_CROP, }; double hscale, vscale;
Documentation/DocBook/media/v4l/vidioc-g-selection.xml +8 -7
@@ -65,8 +65,8 @@ Do not use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is setting the value of &v4l2-selection; <structfield>target</structfield> field -to <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> -V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref +to <constant> V4L2_SEL_TGT_CROP </constant> (<constant> +V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional targets. The <structfield>flags</structfield> and <structfield>reserved </structfield> fields of &v4l2-selection; are ignored and they must be filled
@@ -86,8 +86,8 @@ use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is setting the value of &v4l2-selection; <structfield>target</structfield> to -<constant>V4L2_SEL_TGT_CROP_ACTIVE</constant> (<constant> -V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref +<constant>V4L2_SEL_TGT_CROP</constant> (<constant> +V4L2_SEL_TGT_COMPOSE </constant>). Please refer to table <xref linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be set to the desired active area. Field &v4l2-selection; <structfield> reserved
@@ -161,7 +161,7 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> &cs-def; <tbody valign="top"> <row> - <entry><constant>V4L2_SEL_TGT_CROP_ACTIVE</constant></entry> + <entry><constant>V4L2_SEL_TGT_CROP</constant></entry> <entry>0x0000</entry> <entry>The area that is currently cropped by hardware.</entry> </row>
@@ -176,7 +176,7 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> <entry>Limits for the cropping rectangle.</entry> </row> <row> - <entry><constant>V4L2_SEL_TGT_COMPOSE_ACTIVE</constant></entry> + <entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry> <entry>0x0100</entry> <entry>The area to which data is composed by hardware.</entry> </row>
@@ -193,7 +193,8 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> <row> <entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry> <entry>0x0103</entry> - <entry>The active area and all padding pixels that are inserted or modified by hardware.</entry> + <entry>The active area and all padding pixels that are inserted or + modified by hardware.</entry> </row> </tbody> </tgroup>
drivers/media/video/s5p-fimc/fimc-capture.c +7 -7
@@ -655,7 +655,7 @@ static void fimc_capture_try_selection(struct fimc_ctx *ctx, r->left = r->top =0 ;return ; } -if (target ==V4L2_SEL_TGT_COMPOSE_ACTIVE ) { +if (target ==V4L2_SEL_TGT_COMPOSE ) {if (ctx->rotation !=90 && ctx->rotation !=270 ) align_h =1 ; max_sc_h =min (SCALER_MAX_HRATIO ,1 << (ffs (sink->width) -3 ));
@@ -682,7 +682,7 @@ static void fimc_capture_try_selection(struct fimc_ctx *ctx, rotate ? sink->f_height : sink->f_width); max_h =min_t (u32,FIMC_CAMIF_MAX_HEIGHT , sink->f_height); -if (target ==V4L2_SEL_TGT_COMPOSE_ACTIVE ) { +if (target ==V4L2_SEL_TGT_COMPOSE ) { min_w =min_t (u32, max_w, sink->f_width / max_sc_h); min_h =min_t (u32, max_h, sink->f_height / max_sc_v);if (rotate) {
@@ -1147,9 +1147,9 @@ static int fimc_cap_g_selection(struct file *file, void *fh, s->r.height = f->o_height;return 0 ; -case V4L2_SEL_TGT_COMPOSE_ACTIVE : +case V4L2_SEL_TGT_COMPOSE : f = &ctx->d_frame; -case V4L2_SEL_TGT_CROP_ACTIVE : +case V4L2_SEL_TGT_CROP : s->r.left = f->offs_h; s->r.top = f->offs_v; s->r.width = f->width;
@@ -1185,9 +1185,9 @@ static int fimc_cap_s_selection(struct file *file, void *fh,if (s->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE )return -EINVAL ; -if (s->target ==V4L2_SEL_TGT_COMPOSE_ACTIVE ) +if (s->target ==V4L2_SEL_TGT_COMPOSE ) f = &ctx->d_frame; -else if (s->target ==V4L2_SEL_TGT_CROP_ACTIVE ) +else if (s->target ==V4L2_SEL_TGT_CROP ) f = &ctx->s_frame;else return -EINVAL ;
@@ -1483,7 +1483,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,return -EINVAL ;mutex_lock (&fimc->lock); -fimc_capture_try_selection (ctx, r,V4L2_SEL_TGT_CROP_ACTIVE ); +fimc_capture_try_selection (ctx, r,V4L2_SEL_TGT_CROP );switch (sel->target) {case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS :
drivers/media/video/s5p-fimc/fimc-lite.c +2 -2
@@ -871,7 +871,7 @@ static int fimc_lite_g_selection(struct file *file, void *fh, sel->r.height = f->f_height;return 0 ; -case V4L2_SEL_TGT_COMPOSE_ACTIVE : +case V4L2_SEL_TGT_COMPOSE : sel->r = f->rect;return 0 ; }
@@ -888,7 +888,7 @@ static int fimc_lite_s_selection(struct file *file, void *fh,unsigned long flags;if (sel->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || - sel->target !=V4L2_SEL_TGT_COMPOSE_ACTIVE ) + sel->target !=V4L2_SEL_TGT_COMPOSE )return -EINVAL ;fimc_lite_try_compose (fimc, &rect);
drivers/media/video/s5p-jpeg/jpeg-core.c +2 -2
@@ -824,10 +824,10 @@ static int s5p_jpeg_g_selection(struct file *file, void *priv,/* For JPEG blob active == default == bounds */ switch (s->target) { -case V4L2_SEL_TGT_CROP_ACTIVE : +case V4L2_SEL_TGT_CROP :case V4L2_SEL_TGT_CROP_BOUNDS :case V4L2_SEL_TGT_CROP_DEFAULT : -case V4L2_SEL_TGT_COMPOSE_ACTIVE : +case V4L2_SEL_TGT_COMPOSE :case V4L2_SEL_TGT_COMPOSE_DEFAULT : s->r.width = ctx->out_q.w; s->r.height = ctx->out_q.h;
drivers/media/video/s5p-tv/mixer_video.c +4 -4
@@ -367,7 +367,7 @@ static int mxr_g_selection(struct file *file, void *fh,return -EINVAL ;switch (s->target) { -case V4L2_SEL_TGT_CROP_ACTIVE : +case V4L2_SEL_TGT_CROP : s->r.left = geo->src.x_offset; s->r.top = geo->src.y_offset; s->r.width = geo->src.width;
@@ -380,7 +380,7 @@ static int mxr_g_selection(struct file *file, void *fh, s->r.width = geo->src.full_width; s->r.height = geo->src.full_height;break ; -case V4L2_SEL_TGT_COMPOSE_ACTIVE : +case V4L2_SEL_TGT_COMPOSE :case V4L2_SEL_TGT_COMPOSE_PADDED : s->r.left = geo->dst.x_offset; s->r.top = geo->dst.y_offset;
@@ -449,11 +449,11 @@ static int mxr_s_selection(struct file *file, void *fh, res.height = geo->dst.full_height;break ; -case V4L2_SEL_TGT_CROP_ACTIVE : +case V4L2_SEL_TGT_CROP : target = &geo->src; stage =MXR_GEOMETRY_CROP ;break ; -case V4L2_SEL_TGT_COMPOSE_ACTIVE : +case V4L2_SEL_TGT_COMPOSE :case V4L2_SEL_TGT_COMPOSE_PADDED : target = &geo->dst; stage =MXR_GEOMETRY_COMPOSE ;
drivers/media/video/v4l2-ioctl.c +4 -4
@@ -1486,9 +1486,9 @@ static long __video_do_ioctl(struct file *file,/* crop means compose for output devices */ if (V4L2_TYPE_IS_OUTPUT (p->type)) - s.target =V4L2_SEL_TGT_COMPOSE_ACTIVE ; + s.target =V4L2_SEL_TGT_COMPOSE ;else - s.target =V4L2_SEL_TGT_CROP_ACTIVE ; + s.target =V4L2_SEL_TGT_CROP ; ret = ops->vidioc_g_selection (file, fh, &s);
@@ -1519,9 +1519,9 @@ static long __video_do_ioctl(struct file *file,/* crop means compose for output devices */ if (V4L2_TYPE_IS_OUTPUT (p->type)) - s.target =V4L2_SEL_TGT_COMPOSE_ACTIVE ; + s.target =V4L2_SEL_TGT_COMPOSE ;else - s.target =V4L2_SEL_TGT_CROP_ACTIVE ; + s.target =V4L2_SEL_TGT_CROP ; ret = ops->vidioc_s_selection (file, fh, &s); }
include/linux/videodev2.h +6 -2
@@ -768,13 +768,13 @@ struct v4l2_crop {/* Selection targets */ /* Current cropping area */ -#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000 +#define V4L2_SEL_TGT_CROP 0x0000/* Default cropping area */ #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001/* Cropping bounds */ #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002/* Current composing area */ -#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100 +#define V4L2_SEL_TGT_COMPOSE 0x0100/* Default composing area */ #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101/* Composing bounds */
@@ -782,6 +782,10 @@ struct v4l2_crop {/* Current composing area plus all padding pixels */ #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 +/* Backward compatibility definitions */ +#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP +#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE +/** * struct v4l2_selection - selection info * @type: buffer type (do not use *_MPLANE types)
Signature · 1 line
1.7.2.5
PATCH v4 2/7 v4l: Remove "_ACTUAL" from subdev selection API target definition names
In reply to Sakari AilusThe string "_ACTUAL" does not say anything more about the target names. Drop it. V4L2 selection API was changed by "V4L: Remove "_ACTIVE" from the selection target name definitions" by Sylwester Nawrocki. This patch does the same for the V4L2 subdev API.
--- Documentation/DocBook/media/v4l/dev-subdev.xml | 25 +++++++++---------- .../media/v4l/vidioc-subdev-g-selection.xml | 12 ++++---- drivers/media/video/omap3isp/ispccdc.c | 4 +- drivers/media/video/omap3isp/isppreview.c | 4 +- drivers/media/video/omap3isp/ispresizer.c | 4 +- drivers/media/video/smiapp/smiapp-core.c | 22 ++++++++-------- drivers/media/video/v4l2-subdev.c | 4 +- include/linux/v4l2-subdev.h | 4 +- 8 files changed, 39 insertions(+), 40 deletions(-)
Documentation/DocBook/media/v4l/dev-subdev.xml +12 -13
@@ -289,8 +289,8 @@ &v4l2-rect; by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels.</para> - <para>As for pad formats, drivers store try and active - rectangles for the selection targets of ACTUAL type <xref + <para>As for pad formats, drivers store try and active rectangles for + the selection targets <xref linkend="v4l2-subdev-selection-targets">.</xref></para> <para>On sink pads, cropping is applied relative to the
@@ -308,7 +308,7 @@ <para>Scaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL - using <constant>V4L2_SUBDEV_SEL_COMPOSE_ACTUAL</constant> + using <constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant> selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.</para>
@@ -333,22 +333,21 @@ <title>Types of selection targets</title> <section> - <title>ACTUAL targets</title> + <title>Actual targets</title> - <para>ACTUAL targets reflect the actual hardware configuration - at any point of time. There is a BOUNDS target - corresponding to every ACTUAL.</para> + <para>Actual targets (without a postfix) reflect the actual hardware + configuration at any point of time.</para> </section> <section> <title>BOUNDS targets</title> - <para>BOUNDS targets is the smallest rectangle that contains - all valid ACTUAL rectangles. It may not be possible to set the - ACTUAL rectangle as large as the BOUNDS rectangle, however. - This may be because e.g. a sensor's pixel array is not - rectangular but cross-shaped or round. The maximum size may - also be smaller than the BOUNDS rectangle.</para> + <para>BOUNDS targets is the smallest rectangle that contains all + valid actual rectangles. It may not be possible to set the actual + rectangle as large as the BOUNDS rectangle, however. This may be + because e.g. a sensor's pixel array is not rectangular but + cross-shaped or round. The maximum size may also be smaller than the + BOUNDS rectangle.</para> </section> </section>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +6 -6
@@ -72,10 +72,10 @@ <section> <title>Types of selection targets</title> - <para>There are two types of selection targets: actual and bounds. - The ACTUAL targets are the targets which configure the hardware. - The BOUNDS target will return a rectangle that contain all - possible ACTUAL rectangles.</para> + <para>There are two types of selection targets: plain and bounds. The + actual targets are the targets which configure the hardware. The BOUNDS + target will return a rectangle that contain all possible actual + rectangles.</para> </section> <section>
@@ -93,7 +93,7 @@ &cs-def; <tbody valign="top"> <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL</constant></entry> + <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP</constant></entry> <entry>0x0000</entry> <entry>Actual crop. Defines the cropping performed by the processing step.</entry>
@@ -104,7 +104,7 @@ <entry>Bounds of the crop rectangle.</entry> </row> <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL</constant></entry> + <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant></entry> <entry>0x0100</entry> <entry>Actual compose rectangle. Used to configure scaling on sink pads and composition on source pads.</entry>
drivers/media/video/omap3isp/ispccdc.c +2 -2
@@ -2024,7 +2024,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,ccdc_try_crop (ccdc, format, &sel->r);break ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP : sel->r = *__ccdc_get_crop (ccdc, fh, sel->which);break ;
@@ -2052,7 +2052,7 @@ static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,struct isp_ccdc_device *ccdc =v4l2_get_subdevdata (sd);struct v4l2_mbus_framefmt *format; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL || +if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || sel->pad !=CCDC_PAD_SOURCE_OF )return -EINVAL ;
drivers/media/video/omap3isp/isppreview.c +2 -2
@@ -1960,7 +1960,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,preview_try_crop (prev, format, &sel->r);break ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP : sel->r = *__preview_get_crop (prev, fh, sel->which);break ;
@@ -1988,7 +1988,7 @@ static int preview_set_selection(struct v4l2_subdev *sd,struct isp_prev_device *prev =v4l2_get_subdevdata (sd);struct v4l2_mbus_framefmt *format; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL || +if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || sel->pad !=PREV_PAD_SINK )return -EINVAL ;
drivers/media/video/omap3isp/ispresizer.c +2 -2
@@ -1259,7 +1259,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,resizer_calc_ratios (res, &sel->r, format_source, &ratio);break ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP : sel->r = *__resizer_get_crop (res, fh, sel->which);resizer_calc_ratios (res, &sel->r, format_source, &ratio);break ;
@@ -1293,7 +1293,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,struct v4l2_mbus_framefmt *format_sink, *format_source;struct resizer_ratio ratio; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL || +if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || sel->pad !=RESZ_PAD_SINK )return -EINVAL ;
drivers/media/video/smiapp/smiapp-core.c +11 -11
@@ -1629,7 +1629,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev,smiapp_get_crop_compose (subdev, fh, crops, &comp, which);switch (target) { -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP : comp->width = crops[SMIAPP_PAD_SINK ]->width; comp->height = crops[SMIAPP_PAD_SINK ]->height;if (which ==V4L2_SUBDEV_FORMAT_ACTIVE ) {
@@ -1645,7 +1645,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev, } }/* Fall through */ -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_COMPOSE : *crops[SMIAPP_PAD_SRC ] = *comp;break ;default :
@@ -1721,7 +1721,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,if (fmt->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) ssd->sink_fmt = *crops[ssd->sink_pad];smiapp_propagate (subdev, fh, fmt->which, -V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ); +V4L2_SUBDEV_SEL_TGT_CROP );mutex_unlock (&sensor->mutex);
@@ -1956,7 +1956,7 @@ static int smiapp_set_compose(struct v4l2_subdev *subdev, *comp = sel->r;smiapp_propagate (subdev, fh, sel->which, -V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL ); +V4L2_SUBDEV_SEL_TGT_COMPOSE );if (sel->which ==V4L2_SUBDEV_FORMAT_ACTIVE )return smiapp_update_mode (sensor);
@@ -1972,7 +1972,7 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev,/* We only implement crop in three places. */ switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP :case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS :if (ssd == sensor->pixel_array && sel->pad ==SMIAPP_PA_PAD_SRC )
@@ -1986,7 +1986,7 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev, == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP)return 0 ;return -EINVAL ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_COMPOSE :case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS :if (sel->pad == ssd->source_pad)return -EINVAL ;
@@ -2049,7 +2049,7 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,if (ssd != sensor->pixel_array && sel->pad ==SMIAPP_PAD_SINK )smiapp_propagate (subdev, fh, sel->which, -V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ); +V4L2_SUBDEV_SEL_TGT_CROP );return 0 ; }
@@ -2095,11 +2095,11 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev, sel->r = *comp; }break ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP :case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS : sel->r = *crops[sel->pad];break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_COMPOSE : sel->r = *comp;break ; }
@@ -2146,10 +2146,10 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev, sel->r.height);switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_CROP : ret =smiapp_set_crop (subdev, fh, sel);break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SUBDEV_SEL_TGT_COMPOSE : ret =smiapp_set_compose (subdev, fh, sel);break ;default :
drivers/media/video/v4l2-subdev.c +2 -2
@@ -245,7 +245,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; - sel.target =V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ; + sel.target =V4L2_SUBDEV_SEL_TGT_CROP ; rval =v4l2_subdev_call ( sd, pad, get_selection, subdev_fh, &sel);
@@ -274,7 +274,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; - sel.target =V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ; + sel.target =V4L2_SUBDEV_SEL_TGT_CROP ; sel.r = crop->rect; rval = v4l2_subdev_call(
include/linux/v4l2-subdev.h +2 -2
@@ -128,11 +128,11 @@ struct v4l2_subdev_frame_interval_enum {#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)/* active cropping area */ -#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL 0x0000 +#define V4L2_SUBDEV_SEL_TGT_CROP 0x0000/* cropping bounds */ #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002/* current composing area */ -#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL 0x0100 +#define V4L2_SUBDEV_SEL_TGT_COMPOSE 0x0100/* composing bounds */ #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
Signature · 1 line
1.7.2.5
Re: [PATCH v4 2/7] v4l: Remove "_ACTUAL" from subdev selection API target definition names
Hi Sakari,
Thanks for the patch.
Quoted 27 lines · On Friday 15 June 2012 16:44:35 Sakari Ailus wrote:
The string "
_ACTUAL" does not say anything more about the target names. Drop it. V4L2 selection API was changed by "V4L: Remove "_ACTIVE" from the selection target name definitions" by Sylwester Nawrocki. This patch does the same for the V4L2 subdev API.Signed-off-by Sakari Ailus <[email protected]>--- Documentation/DocBook/media/v4l/dev-subdev.xml | 25 +++++++++---------- .../media/v4l/vidioc-subdev-g-selection.xml | 12 ++++---- drivers/media/video/omap3isp/ispccdc.c | 4 +- drivers/media/video/omap3isp/isppreview.c | 4 +- drivers/media/video/omap3isp/ispresizer.c | 4 +- drivers/media/video/smiapp/smiapp-core.c | 22 ++++++++-------- drivers/media/video/v4l2-subdev.c | 4 +- include/linux/v4l2-subdev.h | 4 +- 8 files changed, 39 insertions(+), 40 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 4afcbbe..ac715dd 100644Documentation/DocBook/media/v4l/dev-subdev.xml +0
-0@@ -289,8 +289,8 @@ &v4l2-rect; by the coordinates of the top left corner and therectangle size. Both the coordinates and sizes are expressed in pixels.</para>
Documentation/DocBook/media/v4l/dev-subdev.xml line 294
Quoted 5 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-2- <para>As for pad formats, drivers store try and active - rectangles for the selection targets of ACTUAL type <xref + <para>As for pad formats, drivers store try and active rectangles for + the selection targets <xref linkend="v4l2-subdev-selection-targets">.</xref></para>
Could you please also fix the xref issue ? According to
http://www.docbook.org/tdg/en/html/xref.html, the xref element is supposed to be empty. You can either use something like
... the selection targets described in <xref .../>
or a link element around "selection targets".
Quoted 13 lines
<para>On sink pads, cropping is applied relative to the
Documentation/DocBook/media/v4l/dev-subdev.xml +1
-1@@ -308,7 +308,7 @@ <para>Scaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL - using <constant>V4L2_SUBDEV_SEL_COMPOSE_ACTUAL</constant> + using <constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant> selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.</para>@@ -333,22 +333,21 @@ <title>Types of selection targets</title>
Documentation/DocBook/media/v4l/dev-subdev.xml line 340
Quoted 10 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +3
-4<section> - <title>ACTUAL targets</title> + <title>Actual targets</title> - <para>ACTUAL targets reflect the actual hardware configuration - at any point of time. There is a BOUNDS target - corresponding to every ACTUAL.</para> + <para>Actual targets (without a postfix) reflect the actual hardware + configuration at any point of time.</para> </section>
Don't we have a bounds target for every actual target ?
Quoted 24 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +6
-6<section> <title>BOUNDS targets</title> - <para>BOUNDS targets is the smallest rectangle that contains - all valid ACTUAL rectangles. It may not be possible to set the - ACTUAL rectangle as large as the BOUNDS rectangle, however. - This may be because e.g. a sensor's pixel array is not - rectangular but cross-shaped or round. The maximum size may - also be smaller than the BOUNDS rectangle.</para> + <para>BOUNDS targets is the smallest rectangle that contains all + valid actual rectangles. It may not be possible to set the actual + rectangle as large as the BOUNDS rectangle, however. This may be + because e.g. a sensor's pixel array is not rectangular but + cross-shaped or round. The maximum size may also be smaller than the + BOUNDS rectangle.</para> </section> </section>(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xmlindex 208e9f0..96ab51e 100644
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 75
Quoted 8 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-4@@ -72,10 +72,10 @@ <section> <title>Types of selection targets</title> - <para>There are two types of selection targets: actual and bounds. - The ACTUAL targets are the targets which configure the hardware. - The BOUNDS target will return a rectangle that contain all - possible ACTUAL rectangles.</para> + <para>There are two types of selection targets: plain and bounds. The
plain or actual ?
Quoted 16 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-0+ actual targets are the targets which configure the hardware. TheBOUNDS + target will return a rectangle that contain all possible
actual + rectangles.</para></section> <section>Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-1@@ -93,7 +93,7 @@ &cs-def; <tbody valign="top"> <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL</constant></entry> + <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP</constant></entry> <entry>0x0000</entry> <entry>Actual crop. Defines the cropping performed by the processing step.</entry>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 107
Quoted 4 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0
-1@@ -104,7 +104,7 @@ <entry>Bounds of the crop rectangle.</entry> </row> <row> -
<entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL</constant></entry>
Quoted 4 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-0+ <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant></entry><entry>0x0100</entry>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0
-0<entry>Actual compose rectangle. Used to configure scaling on sink pads and composition on source pads.</entry>
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v4 2/7] v4l: Remove "_ACTUAL" from subdev selection API target definition names
Hi Laurent,
Quoted 3 lines · Laurent Pinchart
Hi Sakari,
Thanks for the patch.
Thanks for the comments!
Quoted 38 lines · On Friday 15 June 2012 16:44:35 Sakari Ailus wrote:
Quoted 27 lines
The string "
_ACTUAL" does not say anything more about the target names. Drop it. V4L2 selection API was changed by "V4L: Remove "_ACTIVE" from the selection target name definitions" by Sylwester Nawrocki. This patch does the same for the V4L2 subdev API.Signed-off-by Sakari Ailus <[email protected]>--- Documentation/DocBook/media/v4l/dev-subdev.xml | 25 +++++++++---------- .../media/v4l/vidioc-subdev-g-selection.xml | 12 ++++---- drivers/media/video/omap3isp/ispccdc.c | 4 +- drivers/media/video/omap3isp/isppreview.c | 4 +- drivers/media/video/omap3isp/ispresizer.c | 4 +- drivers/media/video/smiapp/smiapp-core.c | 22 ++++++++-------- drivers/media/video/v4l2-subdev.c | 4 +- include/linux/v4l2-subdev.h | 4 +- 8 files changed, 39 insertions(+), 40 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 4afcbbe..ac715dd 100644Documentation/DocBook/media/v4l/dev-subdev.xml +0
-0@@ -289,8 +289,8 @@ &v4l2-rect; by the coordinates of the top left corner and therectangle size. Both the coordinates and sizes are expressed in pixels.</para>
Documentation/DocBook/media/v4l/dev-subdev.xml line 294
Quoted 5 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-2- <para>As for pad formats, drivers store try and active - rectangles for the selection targets of ACTUAL type <xref + <para>As for pad formats, drivers store try and active rectangles for + the selection targets <xref linkend="v4l2-subdev-selection-targets">.</xref></para>Could you please also fix the xref issue ? According to
http://www.docbook.org/tdg/en/html/xref.html, the xref element is supposed to be empty. You can either use something like
Quoted 3 lines
... the selection targets described in <xref .../>
or a link element around "selection targets".
Fixed the xref.
Quoted 17 lines
Quoted 17 lines
<para>On sink pads, cropping is applied relative to the
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-2@@ -308,7 +308,7 @@ <para>Scaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL - using <constant>V4L2_SUBDEV_SEL_COMPOSE_ACTUAL</constant> + using <constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant> selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.</para>@@ -333,22 +333,21 @@ <title>Types of selection targets</title> <section> - <title>ACTUAL targets</title> + <title>Actual targets</title>
Quoted 8 lines
Documentation/DocBook/media/v4l/dev-subdev.xml line 340
Quoted 6 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-3- <para>ACTUAL targets reflect the actual hardware configuration - at any point of time. There is a BOUNDS target - corresponding to every ACTUAL.</para> + <para>Actual targets (without a postfix) reflect the actual hardware + configuration at any point of time.</para> </section>Don't we have a bounds target for every actual target ?
Oh. That probably got accidentally removed. I'll fix it.
Quoted 27 lines
Quoted 27 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +6
-6<section> <title>BOUNDS targets</title> - <para>BOUNDS targets is the smallest rectangle that contains - all valid ACTUAL rectangles. It may not be possible to set the - ACTUAL rectangle as large as the BOUNDS rectangle, however. - This may be because e.g. a sensor's pixel array is not - rectangular but cross-shaped or round. The maximum size may - also be smaller than the BOUNDS rectangle.</para> + <para>BOUNDS targets is the smallest rectangle that contains all + valid actual rectangles. It may not be possible to set the actual + rectangle as large as the BOUNDS rectangle, however. This may be + because e.g. a sensor's pixel array is not rectangular but + cross-shaped or round. The maximum size may also be smaller than the + BOUNDS rectangle.</para> </section> </section>(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xmlindex 208e9f0..96ab51e 100644Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0
-0@@ -72,10 +72,10 @@ <section> <title>Types of selection targets</title>
Quoted 7 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 75
Quoted 5 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-4- <para>There are two types of selection targets: actual and bounds. - The ACTUAL targets are the targets which configure the hardware. - The BOUNDS target will return a rectangle that contain all - possible ACTUAL rectangles.</para> + <para>There are two types of selection targets: plain and bounds. Theplain or actual ?
Fixed.
Quoted 21 lines
Quoted 16 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-0+ actual targets are the targets which configure the hardware. TheBOUNDS + target will return a rectangle that contain all possible
actual + rectangles.</para></section> <section>Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-1@@ -93,7 +93,7 @@ &cs-def; <tbody valign="top"> <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL</constant></entry> + <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP</constant></entry> <entry>0x0000</entry> <entry>Actual crop. Defines the cropping performed by the processing step.</entry>Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 107
Quoted 4 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0
-1@@ -104,7 +104,7 @@ <entry>Bounds of the crop rectangle.</entry> </row> <row> -<entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL</constant></entry>
Quoted 5 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 110
Quoted 4 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1
-0+ <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant></entry><entry>0x0100</entry>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0
-0<entry>Actual compose rectangle. Used to configure scaling on sink pads and composition on source pads.</entry>
Cheers,
Signature · 2 lines
Sakari Ailus [email protected]
PATCH v4 3/7 v4l: Unify selection targets across V4L2 and V4L2 subdev interfaces
In reply to Sakari Ailus--- drivers/media/video/omap3isp/ispccdc.c | 6 ++-- drivers/media/video/omap3isp/isppreview.c | 6 ++-- drivers/media/video/omap3isp/ispresizer.c | 6 ++-- drivers/media/video/s5p-fimc/fimc-capture.c | 18 +++++----- drivers/media/video/s5p-fimc/fimc-lite.c | 11 +++--- drivers/media/video/smiapp/smiapp-core.c | 30 ++++++++-------- drivers/media/video/v4l2-subdev.c | 4 +- include/linux/v4l2-common.h | 53 +++++++++++++++++++++++++++ include/linux/v4l2-subdev.h | 14 ++------ include/linux/videodev2.h | 25 ++----------- 10 files changed, 99 insertions(+), 74 deletions(-) create mode 100644 include/linux/v4l2-common.h
drivers/media/video/omap3isp/ispccdc.c +3 -3
@@ -2014,7 +2014,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,return -EINVAL ;switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS : sel->r.left =0 ; sel->r.top =0 ; sel->r.width =INT_MAX ;
@@ -2024,7 +2024,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,ccdc_try_crop (ccdc, format, &sel->r);break ; -case V4L2_SUBDEV_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP : sel->r = *__ccdc_get_crop (ccdc, fh, sel->which);break ;
@@ -2052,7 +2052,7 @@ static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,struct isp_ccdc_device *ccdc =v4l2_get_subdevdata (sd);struct v4l2_mbus_framefmt *format; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || +if (sel->target !=V4L2_SEL_TGT_CROP || sel->pad !=CCDC_PAD_SOURCE_OF )return -EINVAL ;
drivers/media/video/omap3isp/isppreview.c +3 -3
@@ -1949,7 +1949,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,return -EINVAL ;switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS : sel->r.left =0 ; sel->r.top =0 ; sel->r.width =INT_MAX ;
@@ -1960,7 +1960,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,preview_try_crop (prev, format, &sel->r);break ; -case V4L2_SUBDEV_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP : sel->r = *__preview_get_crop (prev, fh, sel->which);break ;
@@ -1988,7 +1988,7 @@ static int preview_set_selection(struct v4l2_subdev *sd,struct isp_prev_device *prev =v4l2_get_subdevdata (sd);struct v4l2_mbus_framefmt *format; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || +if (sel->target !=V4L2_SEL_TGT_CROP || sel->pad !=PREV_PAD_SINK )return -EINVAL ;
drivers/media/video/omap3isp/ispresizer.c +3 -3
@@ -1249,7 +1249,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd, sel->which);switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS : sel->r.left =0 ; sel->r.top =0 ; sel->r.width =INT_MAX ;
@@ -1259,7 +1259,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,resizer_calc_ratios (res, &sel->r, format_source, &ratio);break ; -case V4L2_SUBDEV_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP : sel->r = *__resizer_get_crop (res, fh, sel->which);resizer_calc_ratios (res, &sel->r, format_source, &ratio);break ;
@@ -1293,7 +1293,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,struct v4l2_mbus_framefmt *format_sink, *format_source;struct resizer_ratio ratio; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP || +if (sel->target !=V4L2_SEL_TGT_CROP || sel->pad !=RESZ_PAD_SINK )return -EINVAL ;
drivers/media/video/s5p-fimc/fimc-capture.c +9 -9
@@ -1429,9 +1429,9 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,mutex_lock (&fimc->lock);switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS : +case V4L2_SEL_TGT_COMPOSE_BOUNDS : f = &ctx->d_frame; -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS : r->width = f->o_width; r->height = f->o_height; r->left =0 ;
@@ -1439,10 +1439,10 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,mutex_unlock (&fimc->lock);return 0 ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SEL_TGT_CROP : try_sel =v4l2_subdev_get_try_crop (fh, sel->pad);break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SEL_TGT_COMPOSE : try_sel =v4l2_subdev_get_try_compose (fh, sel->pad); f = &ctx->d_frame;break ;
@@ -1486,9 +1486,9 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,fimc_capture_try_selection (ctx, r,V4L2_SEL_TGT_CROP );switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS : +case V4L2_SEL_TGT_COMPOSE_BOUNDS : f = &ctx->d_frame; -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS : r->width = f->o_width; r->height = f->o_height; r->left =0 ;
@@ -1496,10 +1496,10 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,mutex_unlock (&fimc->lock);return 0 ; -case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL : +case V4L2_SEL_TGT_CROP : try_sel =v4l2_subdev_get_try_crop (fh, sel->pad);break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL : +case V4L2_SEL_TGT_COMPOSE : try_sel =v4l2_subdev_get_try_compose (fh, sel->pad); f = &ctx->d_frame;break ;
@@ -1515,7 +1515,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,set_frame_crop (f, r->left, r->top, r->width, r->height);set_bit (ST_CAPT_APPLY_CFG , &fimc->state);spin_unlock_irqrestore (&fimc->slock, flags); -if (sel->target ==V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL ) +if (sel->target ==V4L2_SEL_TGT_COMPOSE ) ctx->state |=FIMC_COMPOSE ; }
drivers/media/video/s5p-fimc/fimc-lite.c +5 -6
@@ -1086,9 +1086,9 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd,struct fimc_lite *fimc =v4l2_get_subdevdata (sd);struct flite_frame *f = &fimc->inp_frame; -if ((sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL && - sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS ) || - sel->pad !=FLITE_SD_PAD_SINK ) +if ((sel->target !=V4L2_SEL_TGT_CROP && + sel->target !=V4L2_SEL_TGT_CROP_BOUNDS ) || + sel->pad !=FLITE_SD_PAD_SINK )return -EINVAL ;if (sel->which ==V4L2_SUBDEV_FORMAT_TRY ) {
@@ -1097,7 +1097,7 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd, }mutex_lock (&fimc->lock); -if (sel->target ==V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ) { +if (sel->target ==V4L2_SEL_TGT_CROP ) { sel->r = f->rect; }else { sel->r.left =0 ;
@@ -1122,8 +1122,7 @@ static int fimc_lite_subdev_set_selection(struct v4l2_subdev *sd,struct flite_frame *f = &fimc->inp_frame;int ret =0 ; -if (sel->target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL || - sel->pad !=FLITE_SD_PAD_SINK ) +if (sel->target !=V4L2_SEL_TGT_CROP || sel->pad !=FLITE_SD_PAD_SINK )return -EINVAL ;mutex_lock (&fimc->lock);
drivers/media/video/smiapp/smiapp-core.c +15 -15
@@ -1629,7 +1629,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev,smiapp_get_crop_compose (subdev, fh, crops, &comp, which);switch (target) { -case V4L2_SUBDEV_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP : comp->width = crops[SMIAPP_PAD_SINK ]->width; comp->height = crops[SMIAPP_PAD_SINK ]->height;if (which ==V4L2_SUBDEV_FORMAT_ACTIVE ) {
@@ -1645,7 +1645,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev, } }/* Fall through */ -case V4L2_SUBDEV_SEL_TGT_COMPOSE : +case V4L2_SEL_TGT_COMPOSE : *crops[SMIAPP_PAD_SRC ] = *comp;break ;default :
@@ -1721,7 +1721,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,if (fmt->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) ssd->sink_fmt = *crops[ssd->sink_pad];smiapp_propagate (subdev, fh, fmt->which, -V4L2_SUBDEV_SEL_TGT_CROP ); +V4L2_SEL_TGT_CROP );mutex_unlock (&sensor->mutex);
@@ -1956,7 +1956,7 @@ static int smiapp_set_compose(struct v4l2_subdev *subdev, *comp = sel->r;smiapp_propagate (subdev, fh, sel->which, -V4L2_SUBDEV_SEL_TGT_COMPOSE ); +V4L2_SEL_TGT_COMPOSE );if (sel->which ==V4L2_SUBDEV_FORMAT_ACTIVE )return smiapp_update_mode (sensor);
@@ -1972,8 +1972,8 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev,/* We only implement crop in three places. */ switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP : -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP_BOUNDS :if (ssd == sensor->pixel_array && sel->pad ==SMIAPP_PA_PAD_SRC )return 0 ;
@@ -1986,8 +1986,8 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev, == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP)return 0 ;return -EINVAL ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE : -case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS : +case V4L2_SEL_TGT_COMPOSE : +case V4L2_SEL_TGT_COMPOSE_BOUNDS :if (sel->pad == ssd->source_pad)return -EINVAL ;if (ssd == sensor->binner)
@@ -2049,7 +2049,7 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,if (ssd != sensor->pixel_array && sel->pad ==SMIAPP_PAD_SINK )smiapp_propagate (subdev, fh, sel->which, -V4L2_SUBDEV_SEL_TGT_CROP ); +V4L2_SEL_TGT_CROP );return 0 ; }
@@ -2083,7 +2083,7 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev, }switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS : +case V4L2_SEL_TGT_CROP_BOUNDS :if (ssd == sensor->pixel_array) { sel->r.width = sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX ] +1 ;
@@ -2095,11 +2095,11 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev, sel->r = *comp; }break ; -case V4L2_SUBDEV_SEL_TGT_CROP : -case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS : +case V4L2_SEL_TGT_CROP : +case V4L2_SEL_TGT_COMPOSE_BOUNDS : sel->r = *crops[sel->pad];break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE : +case V4L2_SEL_TGT_COMPOSE : sel->r = *comp;break ; }
@@ -2146,10 +2146,10 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev, sel->r.height);switch (sel->target) { -case V4L2_SUBDEV_SEL_TGT_CROP : +case V4L2_SEL_TGT_CROP : ret =smiapp_set_crop (subdev, fh, sel);break ; -case V4L2_SUBDEV_SEL_TGT_COMPOSE : +case V4L2_SEL_TGT_COMPOSE : ret =smiapp_set_compose (subdev, fh, sel);break ;default :
drivers/media/video/v4l2-subdev.c +2 -2
@@ -245,7 +245,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; - sel.target =V4L2_SUBDEV_SEL_TGT_CROP ; + sel.target =V4L2_SEL_TGT_CROP ; rval =v4l2_subdev_call ( sd, pad, get_selection, subdev_fh, &sel);
@@ -274,7 +274,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; - sel.target =V4L2_SUBDEV_SEL_TGT_CROP ; + sel.target =V4L2_SEL_TGT_CROP ; sel.r = crop->rect; rval = v4l2_subdev_call(
include/linux/v4l2-common.h new file +53 -0
53 lines not on this page · raw message
include/linux/v4l2-subdev.h +3 -11
@@ -25,6 +25,7 @@#include <linux/ioctl.h> #include <linux/types.h> +#include <linux/v4l2-common.h> #include <linux/v4l2-mediabus.h> /**
@@ -127,22 +128,13 @@ struct v4l2_subdev_frame_interval_enum {#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2) -/* active cropping area */ -#define V4L2_SUBDEV_SEL_TGT_CROP 0x0000 -/* cropping bounds */ -#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002 -/* current composing area */ -#define V4L2_SUBDEV_SEL_TGT_COMPOSE 0x0100 -/* composing bounds */ -#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102 - -/** * struct v4l2_subdev_selection - selection info * * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY * @pad: pad number, as reported by the media API -* @target: selection target, used to choose one of possible rectangles +* @target: Selection target, used to choose one of possible rectangles, +* defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraint flags * @r: coordinates of the selection window * @reserved: for future use, set to zero for now
include/linux/videodev2.h +3 -22
@@ -64,6 +64,7 @@#include <linux/compiler.h> #include <linux/ioctl.h> #include <linux/types.h> +#include <linux/v4l2-common.h> /* * Common stuff for both V4L1 and V4L2
@@ -765,31 +766,11 @@ struct v4l2_crop {#define V4L2_SEL_FLAG_GE 0x00000001#define V4L2_SEL_FLAG_LE 0x00000002 -/* Selection targets */ - -/* Current cropping area */ -#define V4L2_SEL_TGT_CROP 0x0000 -/* Default cropping area */ -#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 -/* Cropping bounds */ -#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 -/* Current composing area */ -#define V4L2_SEL_TGT_COMPOSE 0x0100 -/* Default composing area */ -#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 -/* Composing bounds */ -#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 -/* Current composing area plus all padding pixels */ -#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 - -/* Backward compatibility definitions */ -#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP -#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE -/** * struct v4l2_selection - selection info * @type: buffer type (do not use *_MPLANE types) -* @target: selection target, used to choose one of possible rectangles +* @target: Selection target, used to choose one of possible rectangles; +* defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraints flags * @r: coordinates of selection window * @reserved: for future use, rounds structure size to 64 bytes, set to zero
Signature · 1 line
1.7.2.5
PATCH v4 4/7 v4l: Common documentation for selection targets
In reply to Sakari AilusBoth V4L2 and V4L2 subdev interface have very similar selection APIs with differences foremost related to in-memory and media bus formats. However, the selection targets are the same for both. Most targets are and in the future will likely continue to be more the same than with any differences. Thus it makes sense to unify the documentation of the targets.
--- Documentation/DocBook/media/v4l/compat.xml | 9 +- Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +- Documentation/DocBook/media/v4l/selection-api.xml | 6 +- .../DocBook/media/v4l/selections-common.xml | 92 ++++++++++++++++++++ Documentation/DocBook/media/v4l/v4l2.xml | 5 + .../DocBook/media/v4l/vidioc-g-selection.xml | 54 +----------- .../media/v4l/vidioc-subdev-g-selection.xml | 34 +------- 7 files changed, 118 insertions(+), 92 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/selections-common.xml
Documentation/DocBook/media/v4l/compat.xml +5 -4
@@ -2377,10 +2377,11 @@ that used it. It was originally scheduled for removal in 2.6.35. <para>V4L2_CTRL_FLAG_VOLATILE was added to signal volatile controls to userspace.</para> </listitem> <listitem> - <para>Add selection API for extended control over cropping and -composing. Does not affect the compatibility of current drivers and -applications. See <link linkend="selection-api"> selection API </link> for -details.</para> + <para>Add selection API for extended control over cropping + and composing. Does not affect the compatibility of current + drivers and applications. See <link + linkend="selection-api"> selection API </link> for + details.</para> </listitem> </orderedlist> </section>
Documentation/DocBook/media/v4l/dev-subdev.xml +5 -5
@@ -276,7 +276,7 @@ </para> </section> - <section> + <section id="v4l2-subdev-selections"> <title>Selections: cropping, scaling and composition</title> <para>Many sub-devices support cropping frames on their input or output
@@ -289,9 +289,9 @@ &v4l2-rect; by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels.</para> - <para>As for pad formats, drivers store try and active rectangles for - the selection targets <xref - linkend="v4l2-subdev-selection-targets">.</xref></para> + <para>As for pad formats, drivers store try and active + rectangles for the selection targets <xref + linkend="v4l2-selections-common">.</xref></para> <para>On sink pads, cropping is applied relative to the current pad format. The pad format represents the image size as
@@ -308,7 +308,7 @@ <para>Scaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL - using <constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant> + using <constant>V4L2_SEL_TGT_COMPOSE</constant> selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.</para>
Documentation/DocBook/media/v4l/selection-api.xml +3 -3
@@ -53,11 +53,11 @@ cropping and composing rectangles have the same size.</para> </mediaobject> </figure> -For complete list of the available selection targets see table <xref -linkend="v4l2-sel-target"/> - </section> + See <xref linkend="v4l2-selection-targets-table" /> for more + information. + <section> <title>Configuration</title>
Documentation/DocBook/media/v4l/selections-common.xml new file +92 -0
92 lines not on this page · raw message
Documentation/DocBook/media/v4l/v4l2.xml +5 -0
@@ -589,6 +589,11 @@ and discussions on the V4L mailing list.</revremark> &sub-write; </appendix> + <appendix> + <title>Common definitions for V4L2 and V4L2 subdev interfaces</title> + &sub-selections-common; + </appendix> + <appendix id="videodev"> <title>Video For Linux Two Header File</title> &sub-videodev2-h;
Documentation/DocBook/media/v4l/vidioc-g-selection.xml +5 -49
78 lines not on this page · raw message
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +3 -31
@@ -87,36 +87,8 @@ <constant>EINVAL</constant>.</para> </section> - <table pgwide="1" frame="none" id="v4l2-subdev-selection-targets"> - <title>V4L2 subdev selection targets</title> - <tgroup cols="3"> - &cs-def; - <tbody valign="top"> - <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP</constant></entry> - <entry>0x0000</entry> - <entry>Actual crop. Defines the cropping - performed by the processing step.</entry> - </row> - <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS</constant></entry> - <entry>0x0002</entry> - <entry>Bounds of the crop rectangle.</entry> - </row> - <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE</constant></entry> - <entry>0x0100</entry> - <entry>Actual compose rectangle. Used to configure scaling - on sink pads and composition on source pads.</entry> - </row> - <row> - <entry><constant>V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS</constant></entry> - <entry>0x0102</entry> - <entry>Bounds of the compose rectangle.</entry> - </row> - </tbody> - </tgroup> - </table> + <para>Selection targets are documented in <xref + linkend="v4l2-selections-common"/>.</para> <table pgwide="1" frame="none" id="v4l2-subdev-selection-flags"> <title>V4L2 subdev selection flags</title>
@@ -173,7 +145,7 @@ <entry>__u32</entry> <entry><structfield>target</structfield></entry> <entry>Target selection rectangle. See - <xref linkend="v4l2-subdev-selection-targets">.</xref>.</entry> + <xref linkend="v4l2-selections-common">.</xref>.</entry> </row> <row> <entry>__u32</entry>
Signature · 1 line
1.7.2.5
PATCH v4 5/7 v4l: Unify selection flags
In reply to Sakari AilusUnify flags on the selection interfaces on V4L2 and V4L2 subdev. Flags are very similar to targets in this case: there are more similarities than differences between the two interfaces.
--- drivers/media/video/omap3isp/ispccdc.c | 2 +- drivers/media/video/omap3isp/isppreview.c | 2 +- drivers/media/video/smiapp/smiapp-core.c | 10 +++++----- include/linux/v4l2-common.h | 5 +++++ include/linux/v4l2-subdev.h | 6 +----- include/linux/videodev2.h | 6 +----- 6 files changed, 14 insertions(+), 17 deletions(-)
drivers/media/video/omap3isp/ispccdc.c +1 -1
@@ -2064,7 +2064,7 @@ static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,* pad. If the KEEP_CONFIG flag is set, just return the current crop * rectangle. */ -if (sel->flags &V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG ) { +if (sel->flags &V4L2_SEL_FLAG_KEEP_CONFIG ) { sel->r = *__ccdc_get_crop (ccdc, fh, sel->which);return 0 ; }
drivers/media/video/omap3isp/isppreview.c +1 -1
@@ -2000,7 +2000,7 @@ static int preview_set_selection(struct v4l2_subdev *sd,* pad. If the KEEP_CONFIG flag is set, just return the current crop * rectangle. */ -if (sel->flags &V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG ) { +if (sel->flags &V4L2_SEL_FLAG_KEEP_CONFIG ) { sel->r = *__preview_get_crop (prev, fh, sel->which);return 0 ; }
drivers/media/video/smiapp/smiapp-core.c +5 -5
@@ -37,9 +37,9 @@#include "smiapp.h" -#define SMIAPP_ALIGN_DIM (dim, flags) \ - ((flags) & V4L2_SUBDEV_SEL_FLAG_SIZE_GE \ - ? ALIGN((dim), 2) \ +#define SMIAPP_ALIGN_DIM (dim, flags) \ + ((flags) & V4L2_SEL_FLAG_GE \ + ? ALIGN((dim), 2) \ : (dim) & ~1)/*
@@ -1746,14 +1746,14 @@ static int scaling_goodness(struct v4l2_subdev *subdev, int w, int ask_w, h &= ~1 ; ask_h &= ~1 ; -if (flags &V4L2_SUBDEV_SEL_FLAG_SIZE_GE ) { +if (flags &V4L2_SEL_FLAG_GE ) {if (w < ask_w) val -=SCALING_GOODNESS ;if (h < ask_h) val -=SCALING_GOODNESS ; } -if (flags &V4L2_SUBDEV_SEL_FLAG_SIZE_LE ) { +if (flags &V4L2_SEL_FLAG_LE ) {if (w > ask_w) val -=SCALING_GOODNESS ;if (h > ask_h)
include/linux/v4l2-common.h +5 -0
@@ -50,4 +50,9 @@#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE +/* Selection flags */ +#define V4L2_SEL_FLAG_GE (1 << 0) +#define V4L2_SEL_FLAG_LE (1 << 1) +#define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2) +#endif /* __V4L2_COMMON__ */
include/linux/v4l2-subdev.h +1 -5
@@ -124,10 +124,6 @@ struct v4l2_subdev_frame_interval_enum {__u32 reserved[9 ]; }; -#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 << 0) -#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1) -#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2) -/** * struct v4l2_subdev_selection - selection info *
@@ -135,7 +131,7 @@ struct v4l2_subdev_frame_interval_enum {* @pad: pad number, as reported by the media API * @target: Selection target, used to choose one of possible rectangles, * defined in v4l2-common.h; V4L2_SEL_TGT_* . -* @flags: constraint flags +* @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of the selection window * @reserved: for future use, set to zero for now *
include/linux/videodev2.h +1 -5
@@ -762,16 +762,12 @@ struct v4l2_crop {struct v4l2_rect c; }; -/* Hints for adjustments of selection rectangle */ -#define V4L2_SEL_FLAG_GE 0x00000001 -#define V4L2_SEL_FLAG_LE 0x00000002 -/** * struct v4l2_selection - selection info * @type: buffer type (do not use *_MPLANE types) * @target: Selection target, used to choose one of possible rectangles; * defined in v4l2-common.h; V4L2_SEL_TGT_* . -* @flags: constraints flags +* @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of selection window * @reserved: for future use, rounds structure size to 64 bytes, set to zero *
Signature · 1 line
1.7.2.5
PATCH v4 6/7 v4l: Unify selection flags documentation
In reply to Sakari AilusAs for the selection targets, the selection flags are now the same on V4L2 and V4L2 subdev interfaces. Also document them so.
--- Documentation/DocBook/media/v4l/dev-subdev.xml | 6 +- Documentation/DocBook/media/v4l/selection-api.xml | 6 +- .../DocBook/media/v4l/selections-common.xml | 226 +++++++++++++------- .../DocBook/media/v4l/vidioc-g-selection.xml | 27 +--- .../media/v4l/vidioc-subdev-g-selection.xml | 39 +---- 5 files changed, 159 insertions(+), 145 deletions(-)
Documentation/DocBook/media/v4l/dev-subdev.xml +3 -3
@@ -323,10 +323,10 @@ <para>The drivers should always use the closest possible rectangle the user requests on all selection targets, unless specifically told otherwise. - <constant>V4L2_SUBDEV_SEL_FLAG_SIZE_GE</constant> and - <constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant> flags may be + <constant>V4L2_SEL_FLAG_GE</constant> and + <constant>V4L2_SEL_FLAG_LE</constant> flags may be used to round the image size either up or down. <xref - linkend="v4l2-subdev-selection-flags"></xref></para> + linkend="v4l2-selection-flags"></xref></para> </section> <section>
Documentation/DocBook/media/v4l/selection-api.xml +3 -3
@@ -55,7 +55,7 @@ cropping and composing rectangles have the same size.</para> </section> - See <xref linkend="v4l2-selection-targets-table" /> for more + See <xref linkend="v4l2-selection-targets" /> for more information. <section>
@@ -74,7 +74,7 @@ cropping/composing rectangles may have to be aligned, and both the source and the sink may have arbitrary upper and lower size limits. Therefore, as usual, drivers are expected to adjust the requested parameters and return the actual values selected. An application can control the rounding behaviour using <link -linkend="v4l2-sel-flags"> constraint flags </link>.</para> +linkend="v4l2-selection-flags"> constraint flags </link>.</para> <section>
@@ -117,7 +117,7 @@ the bounds rectangle. The composing rectangle must lie completely inside bounds rectangle. The driver must adjust the composing rectangle to fit to the bounding limits. Moreover, the driver can perform other adjustments according to hardware limitations. The application can control rounding behaviour using -<link linkend="v4l2-sel-flags"> constraint flags </link>.</para> +<link linkend="v4l2-selection-flags"> constraint flags </link>.</para> <para>For capture devices the default composing rectangle is queried using <constant> V4L2_SEL_TGT_COMPOSE_DEFAULT </constant>. It is usually equal to the
Documentation/DocBook/media/v4l/selections-common.xml +149 -77
238 lines not on this page · raw message
Documentation/DocBook/media/v4l/vidioc-g-selection.xml +2 -25
@@ -154,32 +154,9 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> </refsect1> - <para>Selection targets are documented in <xref + <para>Selection targets and flags are documented in <xref linkend="v4l2-selections-common"/>.</para> - <refsect1> - <table frame="none" pgwide="1" id="v4l2-sel-flags"> - <title>Selection constraint flags</title> - <tgroup cols="3"> - &cs-def; - <tbody valign="top"> - <row> - <entry><constant>V4L2_SEL_FLAG_GE</constant></entry> - <entry>0x00000001</entry> - <entry>Indicates that the adjusted rectangle must contain the original - &v4l2-selection; <structfield>r</structfield> rectangle.</entry> - </row> - <row> - <entry><constant>V4L2_SEL_FLAG_LE</constant></entry> - <entry>0x00000002</entry> - <entry>Indicates that the adjusted rectangle must be inside the original - &v4l2-rect; <structfield>r</structfield> rectangle.</entry> - </row> - </tbody> - </tgroup> - </table> - </refsect1> - <section> <figure id="sel-const-adjust"> <title>Size adjustments with constraint flags.</title>
@@ -216,7 +193,7 @@ exist no rectangle </emphasis> that satisfies the constraints.</para> <entry>__u32</entry> <entry><structfield>flags</structfield></entry> <entry>Flags controlling the selection rectangle adjustments, refer to - <link linkend="v4l2-sel-flags">selection flags</link>.</entry> + <link linkend="v4l2-selection-flags">selection flags</link>.</entry> </row> <row> <entry>&v4l2-rect;</entry>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +2 -37
@@ -87,44 +87,9 @@ <constant>EINVAL</constant>.</para> </section> - <para>Selection targets are documented in <xref + <para>Selection targets and flags are documented in <xref linkend="v4l2-selections-common"/>.</para> - <table pgwide="1" frame="none" id="v4l2-subdev-selection-flags"> - <title>V4L2 subdev selection flags</title> - <tgroup cols="3"> - &cs-def; - <tbody valign="top"> - <row> - <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_GE</constant></entry> - <entry>(1 << 0)</entry> <entry>Suggest the driver it - should choose greater or equal rectangle (in size) than - was requested. Albeit the driver may choose a lesser size, - it will only do so due to hardware limitations. Without - this flag (and - <constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant>) the - behaviour is to choose the closest possible - rectangle.</entry> - </row> - <row> - <entry><constant>V4L2_SUBDEV_SEL_FLAG_SIZE_LE</constant></entry> - <entry>(1 << 1)</entry> <entry>Suggest the driver it - should choose lesser or equal rectangle (in size) than was - requested. Albeit the driver may choose a greater size, it - will only do so due to hardware limitations.</entry> - </row> - <row> - <entry><constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant></entry> - <entry>(1 << 2)</entry> - <entry>The configuration should not be propagated to any - further processing steps. If this flag is not given, the - configuration is propagated inside the subdevice to all - further processing steps.</entry> - </row> - </tbody> - </tgroup> - </table> - <table pgwide="1" frame="none" id="v4l2-subdev-selection"> <title>struct <structname>v4l2_subdev_selection</structname></title> <tgroup cols="3">
@@ -151,7 +116,7 @@ <entry>__u32</entry> <entry><structfield>flags</structfield></entry> <entry>Flags. See - <xref linkend="v4l2-subdev-selection-flags">.</xref></entry> + <xref linkend="v4l2-selection-flags">.</xref></entry> </row> <row> <entry>&v4l2-rect;</entry>
Signature · 1 line
1.7.2.5
PATCH v4 7/7 v4l: Correct conflicting V4L2 subdev selection API documentation
In reply to Sakari AilusThe API reference documents that the KEEP_CONFIG flag tells the configuration should not be propatgated by the driver whereas the interface documentation (dev-subdev.xml) categorically prohibited any changes to the rest of the pipeline. The latter makes no sense, since it would severely limit the usefulness of the KEEP_CONFIG flag.
Correct the documentation in dev-subddev.xml.
--- Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
Documentation/DocBook/media/v4l/dev-subdev.xml +5 -5
@@ -361,11 +361,11 @@ performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set - <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware.</para> + <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag, + which tells the driver to make minimum changes to the rest of + the subdev's configuration. This may also cause the accessed + rectangle to be adjusted by the driver, depending on the + properties of the underlying hardware.</para> <para>The coordinates to a step always refer to the actual size of the previous step. The exception to this rule is the source
Signature · 1 line
1.7.2.5
Re: [PATCH v4 7/7] v4l: Correct conflicting V4L2 subdev selection API documentation
Hi Sakari,
Thanks for the patch.
Quoted 2 lines · On Friday 15 June 2012 16:44:40 Sakari Ailus wrote:
The API reference documents that the
KEEP_CONFIGflag tells the configuration should not be propatgated by the driver whereas the interface
s/propatgated/propagated/
Quoted 17 lines
documentation (dev-subdev.xml) categorically prohibited any changes to the rest of the pipeline. The latter makes no sense, since it would severely limit the usefulness of the
KEEP_CONFIGflag.Correct the documentation in dev-subddev.xml.
Signed-off-by Sakari Ailus <[email protected]>--- Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 8c44b3f..95ebf87 100644
Documentation/DocBook/media/v4l/dev-subdev.xml line 364
Quoted 9 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +1
-5@@ -361,11 +361,11 @@ performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set - <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware.</para> + <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag,
This should be V4L2_SEL_FLAG_KEEP_CONFIG.
Documentation/DocBook/media/v4l/dev-subdev.xml line 366
Quoted 2 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-0+ which tells the driver to make minimum changes to the rest of + the subdev's configuration.
I'm not sure to like this. "minimum changes" is not clearly defined. Isn't the point of the KEEP_CONFIG flag is to avoid propagating *any* change down the pipeline inside the subdev ?
Quoted 6 lines
This may also cause the accessed
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-0+ rectangle to be adjusted by the driver, depending on the + properties of the underlying hardware.</para> <para>The coordinates to a step always refer to the actual size of the previous step. The exception to this rule is the source
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v4 7/7] v4l: Correct conflicting V4L2 subdev selection API documentation
Hi Laurent,
Thanks for the comments!
Quoted 39 lines · Laurent Pinchart
Hi Sakari,
Thanks for the patch.
Quoted 2 lines · On Friday 15 June 2012 16:44:40 Sakari Ailus wrote:
The API reference documents that the
KEEP_CONFIGflag tells the configuration should not be propatgated by the driver whereas the interfaces/propatgated/propagated/
Quoted 17 lines
documentation (dev-subdev.xml) categorically prohibited any changes to the rest of the pipeline. The latter makes no sense, since it would severely limit the usefulness of the
KEEP_CONFIGflag.Correct the documentation in dev-subddev.xml.
Signed-off-by Sakari Ailus <[email protected]>--- Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 8c44b3f..95ebf87 100644Documentation/DocBook/media/v4l/dev-subdev.xml line 364
Quoted 9 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +1
-5@@ -361,11 +361,11 @@ performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set - <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware.</para> + <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag,This should be
V4L2_SEL_FLAG_KEEP_CONFIG.
Quoted 6 lines
Documentation/DocBook/media/v4l/dev-subdev.xml line 366
Quoted 2 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-0+ which tells the driver to make minimum changes to the rest of + the subdev's configuration.I'm not sure to like this. "minimum changes" is not clearly defined. Isn't the point of the
KEEP_CONFIGflag is to avoid propagating *any* change down the pipeline inside the subdev ?
Yes, but the hardware may have restrictions that essentially makes the configuration static is absolutely no changes are allowed elsewhere. In those cases it should be possible to allow changes elsewhere.
Or do you think we should just completely disallow them? Would that work e.g. for the OMAP 3 ISP resizer?
Regards,
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
Re: [PATCH v4 7/7] v4l: Correct conflicting V4L2 subdev selection API documentation
Hi Sakari,
Quoted 48 lines · On Friday 15 June 2012 18:31:50 Sakari Ailus wrote:
Quoted 40 lines · Laurent Pinchart
Quoted 3 lines · On Friday 15 June 2012 16:44:40 Sakari Ailus wrote:
The API reference documents that the
KEEP_CONFIGflag tells the configuration should not be propatgated by the driver whereas the interfaces/propatgated/propagated/
Quoted 20 lines
documentation (dev-subdev.xml) categorically prohibited any changes to the
rest of the pipeline. The latter makes no sense, since it would severely limit the usefulness of theKEEP_CONFIGflag.Correct the documentation in dev-subddev.xml.
Signed-off-by Sakari Ailus <[email protected]>---
Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 8c44b3f..95ebf87 100644Documentation/DocBook/media/v4l/dev-subdev.xml +0
-0@@ -361,11 +361,11 @@Documentation/DocBook/media/v4l/dev-subdev.xml line 366
Quoted 10 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +1
-5performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set - <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware.</para> + <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag,This should be
V4L2_SEL_FLAG_KEEP_CONFIG.Quoted 6 lines
Documentation/DocBook/media/v4l/dev-subdev.xml line 368
Quoted 2 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-0+ which tells the driver to make minimum changes to the rest of + the subdev's configuration.I'm not sure to like this. "minimum changes" is not clearly defined. Isn't the point of the
KEEP_CONFIGflag is to avoid propagating *any* change down the pipeline inside the subdev ?
Quoted 6 lines
Yes, but the hardware may have restrictions that essentially makes the configuration static is absolutely no changes are allowed elsewhere. In those cases it should be possible to allow changes elsewhere.
Or do you think we should just completely disallow them? Would that work e.g. for the OMAP 3 ISP resizer?
I think the point of KEEP_CONFIG was to disallow changes completely, to make it possible to change the digital zoom factor during streaming for instance. The OMAP3 ISP resizer should accomodate that. If we allow changes under "some circumstances" applications won't be able to rely on the flag.
Tomasz, Sylwester, what's your opinion on this ?
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v4 7/7] v4l: Correct conflicting V4L2 subdev selection API documentation
Hi Laurent,
Quoted 10 lines · Laurent Pinchart
Hi Sakari,
Quoted 7 lines · On Friday 15 June 2012 18:31:50 Sakari Ailus wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 3 lines · On Friday 15 June 2012 16:44:40 Sakari Ailus wrote:
The API reference documents that the
KEEP_CONFIGflag tells the configuration should not be propatgated by the driver whereas the interfaces/propatgated/propagated/
Fixed.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
documentation (dev-subdev.xml) categorically prohibited any changes to the
rest of the pipeline. The latter makes no sense, since it would severely limit the usefulness of theKEEP_CONFIGflag.Correct the documentation in dev-subddev.xml.
Signed-off-by Sakari Ailus <[email protected]>---
Documentation/DocBook/media/v4l/dev-subdev.xml | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/Documentation/DocBook/media/v4l/dev-subdev.xmlindex 8c44b3f..95ebf87 100644Documentation/DocBook/media/v4l/dev-subdev.xml +0
-0@@ -361,11 +361,11 @@ performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/DocBook/media/v4l/dev-subdev.xml line 364
Quoted 6 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +1
-5- <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware.</para> + <constant>V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG</constant> flag,This should be
V4L2_SEL_FLAG_KEEP_CONFIG.
Fixed in patch number 4.
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Documentation/DocBook/media/v4l/dev-subdev.xml line 368
Quoted 2 lines
Documentation/DocBook/media/v4l/dev-subdev.xml +2
-0+ which tells the driver to make minimum changes to the rest of + the subdev's configuration.I'm not sure to like this. "minimum changes" is not clearly defined. Isn't the point of the
KEEP_CONFIGflag is to avoid propagating *any* change down the pipeline inside the subdev ?Yes, but the hardware may have restrictions that essentially makes the configuration static is absolutely no changes are allowed elsewhere. In those cases it should be possible to allow changes elsewhere.
Quoted 7 lines
Quoted 2 lines
Or do you think we should just completely disallow them? Would that work e.g. for the OMAP 3 ISP resizer?
I think the point of
KEEP_CONFIGwas to disallow changes completely, to make it possible to change the digital zoom factor during streaming for instance. The OMAP3 ISP resizer should accomodate that. If we allow changes under "some circumstances" applications won't be able to rely on the flag.
Let's do this: I make this change to the patch, i.e. disallow changing other rectangles or the format. If we feel we need to change that it'll probably be in 3.6 timeframe. It's also easier to allow doing more things than less --- the likeliness of any possible regression is smaller than denying what used to be possible previously.
Cheers,
Signature · 2 lines
Sakari Ailus [email protected]