Skip to contentSkip to conversation

V4L2 and V4L2 subdev selection target and flag changes

PATCH Superseded Sakari Ailus 2 participants 11 messages Jun 13, 2012

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover V4L2 and V4L2 subdev selection target and flag changes

Hi,

Compared to the previous version of the patchset, I've addressed Sylwester's comments on the 3th patch, and made a few other changes:

- Selection flags have also been unified (patches 5 and 6),
- Documentation had references to old subdev targets (which are now fixed) and
- The common selections section has now been moved under appendices (B).

The resulting HTML documentation is available here:

<URL:http://www.retiisi.org.uk/v4l2/tmp/media_api5/>

I'm planning to send a pull req to Mauro on this late tomorrow Finnish time so if you wish to review it please be quick. :-) :-)

Kind regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#1 lore raw

PATCH v2 1/6 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
index b299e47..ac013e5 100644
@@ -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;, &amp;sel);
 	if (ret)
 		exit(-1);
-	sel.target = V4L2_SEL_TGT_CROP_ACTIVE;
+	sel.target = V4L2_SEL_TGT_CROP;
 	ret = ioctl(fd, &VIDIOC-S-SELECTION;, &amp;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;, &amp;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
index bb04eff..6376e57 100644
@@ -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
index 3545745..356cc5c 100644
@@ -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
index 400d701a..52ede56 100644
@@ -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
index 28b5225d..fbb8e3d 100644
@@ -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
index 33fde2a..6c74b05 100644
@@ -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
index 91be4e8..f3eeea2 100644
@@ -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
index 370d111..7478e7e 100644
@@ -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
#2 lore raw

PATCH v2 2/6 v4l: Remove "_ACTUAL" from subdev selection API target definition names

In reply to Sakari Ailus

The string "_ACTUAL" does not say anything more about the target names. Drop it. V4L2 selection API was changed by "V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]" 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
index 4afcbbe..ac715dd 100644
@@ -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
index 208e9f0..96ab51e 100644
@@ -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
index 7e32331..f19774f 100644
@@ -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
index 8a4935e..1086f6a 100644
@@ -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
index 14041c9..9456652 100644
@@ -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
index f518026..6789a26 100644
@@ -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
index db6e859..cd86f0c 100644
@@ -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
index 812019e..01eee06 100644
@@ -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
#3 lore raw

Re: [PATCH v2 2/6] v4l: Remove "_ACTUAL" from subdev selection API target definition names

Quoted 3 lines · Sakari Ailus

The string "_ACTUAL" does not say anything more about the target names. Drop it. V4L2 selection API was changed by "V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same

The new patch summary line is now:
"V4L: Remove "_ACTIVE" from the selection target name definitions" Hence might be worth to update it also in here.

Quoted 3 lines

for the V4L2 subdev API.

Regards,
Sylwester

#4 lore raw

Re: [PATCH v2 2/6] v4l: Remove "_ACTUAL" from subdev selection API target definition names

Hi Sylwester,

Quoted 11 lines · Sylwester Nawrocki
Quoted 6 lines · Sakari Ailus

The string "_ACTUAL" does not say anything more about the target names. Drop
it. V4L2 selection API was changed by "V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same

The new patch summary line is now:
"V4L: Remove "_ACTIVE" from the selection target name definitions" Hence might be worth to update it also in here.

Thanks. Fixed this one, too.

Regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#5 lore raw

PATCH v2 3/6 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
index f19774f..82df7a0 100644
@@ -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
index 1086f6a..6fa70f4 100644
@@ -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
index 9456652..ae17d91 100644
@@ -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
index 356cc5c..22c28ab 100644
@@ -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
index 52ede56..8785089 100644
@@ -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
index 6789a26..09f0e30 100644
@@ -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
index cd86f0c..9182f81 100644
@@ -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
index 01eee06..1d7d457 100644
@@ -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
index 7478e7e..252f4b2 100644
@@ -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
#6 lore raw

PATCH v2 4/6 v4l: Common documentation for selection targets

In reply to Sakari Ailus

Both 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  |    3 -
 .../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, 115 insertions(+), 92 deletions(-)
 create mode 100644 Documentation/DocBook/media/v4l/selections-common.xml
Documentation/DocBook/media/v4l/compat.xml +5 -4
index ea42ef8..162a0ba 100644
@@ -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
index ac715dd..76c4307 100644
@@ -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 +0 -3
index ac013e5..d652a12 100644
@@ -53,9 +53,6 @@ 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>
 
   <section>
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
index 015c561..87d0f4f 100644
@@ -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
index 96ab51e..fa4063a 100644
@@ -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
#7 lore raw

Re: [PATCH v2 4/6] v4l: Common documentation for selection targets

Hi Sakari,

two minor comments below..

Quoted 93 lines · Sakari Ailus

Both 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  |    3 -
  .../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, 115 insertions(+), 92 deletions(-)

create mode 100644 Documentation/DocBook/media/v4l/selections-common.xml

Documentation/DocBook/media/v4l/compat.xml +5 -4
index ea42ef8..162a0ba 100644
@@ -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
index ac715dd..76c4307 100644
@@ -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 +0 -3
index ac013e5..d652a12 100644
@@ -53,9 +53,6 @@ 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>
 
    <section>
Documentation/DocBook/media/v4l/selections-common.xml new file +0 -0
new file mode 100644
index 0000000..e8f0b02

Documentation/DocBook/media/v4l/selections-common.xml line 6

Quoted 6 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +6 -0
@@ -0,0 +1,92 @@
+<section id="v4l2-selections-common">
+
+<title>Selection targets</title>
+
+<para>While the V4L2<xref linkend="selection-api"/>  and V4L2
+  subdev<xref linkend="v4l2-subdev-selections"/>  selection APIs are very

This sentence isn't quite correct. although I haven't looked myself how this could be improved, wouldn't it be there any way to use custom text for the hyperlink, not what get's pasted automatically ? It doesn't quite parse now.

Quoted 61 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +61 -0
+  similar, there's one fundamental difference between the two. On
+  sub-device API, the selection rectangle is refers to the media bus
+  format, and is bound to a sub-device and a pad. On the V4L2
+  interface the selection rectangles refer to the in-memory pixel
+  format and a video device's buffer queue.</para>
+
+<para>The meaning of the selection targets may thus be affected on
+  which of the two interfaces they are used.</para>
+
+<table pgwide="1" frame="none" id="v4l2-selection-targets-table">
+<title>Selection target definitions</title>
+<tgroup cols="4">
+<colspec colname="c1" />
+<colspec colname="c2" />
+<colspec colname="c3" />
+<colspec colname="c4" />
+<colspec colname="c5" />
+&cs-def;
+<thead>
+	<row rowsep="1">
+	<entry align="left">Target name</entry>
+	<entry align="left">id</entry>
+	<entry align="left">Definition</entry>
+	<entry align="left">Valid for V4L2</entry>
+	<entry align="left">Valid for V4L2 subdev</entry>
+	</row>
+</thead>
+<tbody valign="top">
+	<row>
+	<entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
+	<entry>0x0000</entry>
+	<entry>Crop rectangle. Defines the cropped area.</entry>
+	<entry>X</entry>
+	<entry>X</entry>
+	</row>
+	<row>
+<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
+<entry>0x0001</entry>
+<entry>Suggested cropping rectangle that covers the "whole picture".</entry>
+	<entry>X</entry>
+	<entry>O</entry>
+	</row>
+	<row>
+	<entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
+	<entry>0x0002</entry>
+	<entry>Bounds of the crop rectangle. All valid crop
+	  rectangles fit inside the crop bounds rectangle.
+	</entry>
+	<entry>X</entry>
+	<entry>X</entry>
+	</row>
+	<row>
+	<entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
+	<entry>0x0100</entry>
+	<entry>Compose rectangle. Used to configure scaling
+	  and composition.</entry>
+	<entry>X</entry>
+	<entry>X</entry>
+	</row>
+	<row>
+<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>

Documentation/DocBook/media/v4l/selections-common.xml line 77

Quoted 10 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +10 -0
+<entry>0x0101</entry>
+<entry>Suggested composition rectangle that covers the "whole picture".</entry>
+	<entry>X</entry>
+	<entry>O</entry>
+	</row>
+	<row>
+	<entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
+	<entry>0x0102</entry>
+	<entry>Bounds of the compose rectangle. All valid compose
+	  rectangles fid inside the compose bounds rectangle.</entry>

typo ? s/fid/fit

Quoted 161 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +15 -0
+	<entry>X</entry>
+	<entry>X</entry>
+	</row>
+	<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>X</entry>
+	<entry>O</entry>
+	</row>
+</tbody>
+</tgroup>
+</table>
+</section>
Documentation/DocBook/media/v4l/v4l2.xml +5 -0
index 015c561..87d0f4f 100644
@@ -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
index 6376e57..c6f8325 100644
@@ -67,7 +67,7 @@ Do not use multiplanar buffers.  Use<constant>  V4L2_BUF_TYPE_VIDEO_CAPTURE
  setting the value of&v4l2-selection;<structfield>target</structfield>  field
  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
+linkend="v4l2-selections-common" />  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
  with zeros.  The driver fills the rest of the structure or
@@ -88,7 +88,7 @@ use multiplanar buffers.  Use<constant>  V4L2_BUF_TYPE_VIDEO_CAPTURE
  setting the value of&v4l2-selection;<structfield>target</structfield>  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
+linkend="v4l2-selections-common" />  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
  </structfield>  is ignored and must be filled with zeros.  The driver may adjust
@@ -154,52 +154,8 @@ exist no rectangle</emphasis>  that satisfies the constraints.</para>
 
    </refsect1>
 
-<refsect1>
-<table frame="none" pgwide="1" id="v4l2-sel-target">
-<title>Selection targets.</title>
-<tgroup cols="3">
-	&cs-def;
-	<tbody valign="top">
-	<row>
-<entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
-<entry>0x0000</entry>
-<entry>The area that is currently cropped by hardware.</entry>
-	</row>
-	<row>
-<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
-<entry>0x0001</entry>
-<entry>Suggested cropping rectangle that covers the "whole picture".</entry>
-	</row>
-	<row>
-<entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
-<entry>0x0002</entry>
-<entry>Limits for the cropping rectangle.</entry>
-	</row>
-	<row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
-<entry>0x0100</entry>
-<entry>The area to which data is composed by hardware.</entry>
-	</row>
-	<row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>
-<entry>0x0101</entry>
-<entry>Suggested composing rectangle that covers the "whole picture".</entry>
-	</row>
-	<row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
-<entry>0x0102</entry>
-<entry>Limits for the composing rectangle.</entry>
-	</row>
-	<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>
-	</row>
-	</tbody>
-</tgroup>
-</table>
-</refsect1>
+<para>Selection targets are documented in<xref
+  linkend="v4l2-selections-common"/>.</para>
 
    <refsect1>
      <table frame="none" pgwide="1" id="v4l2-sel-flags">
@@ -253,7 +209,7 @@ exist no rectangle</emphasis>  that satisfies the constraints.</para>
  	<row>
  	<entry>__u32</entry>
  	<entry><structfield>target</structfield></entry>
-<entry>Used to select between<link linkend="v4l2-sel-target">  cropping
+<entry>Used to select between<link linkend="v4l2-selections-common">  cropping
  	    and composing rectangles</link>.</entry>
  	</row>
  	<row>
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +2 -30
index 96ab51e..fa4063a 100644
@@ -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>

Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml line 151

Quoted 8 lines
Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1 -1
@@ -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>

--
Regards,
Sylwester

#8 lore raw

Re: [PATCH v2 4/6] v4l: Common documentation for selection targets

Hi Sylwester,

Quoted 3 lines · Sylwester Nawrocki

Hi Sakari,

two minor comments below..

Thanks for your comments.

Quoted 112 lines · Sakari Ailus
Quoted 111 lines

Both 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  |    3 -
  .../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, 115 insertions(+), 92 deletions(-)

create mode 100644
Documentation/DocBook/media/v4l/selections-common.xml

Documentation/DocBook/media/v4l/compat.xml +0 -0
index ea42ef8..162a0ba 100644
@@ -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>
Documentation/DocBook/media/v4l/compat.xml +0 -3
-    <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

Documentation/DocBook/media/v4l/compat.xml +5 -1
-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 +1 -1
index ac715dd..76c4307 100644
@@ -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

Documentation/DocBook/media/v4l/dev-subdev.xml +0 -0
@@ -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

Documentation/DocBook/media/v4l/dev-subdev.xml +4 -3
-      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 +0 -0
index ac013e5..d652a12 100644
@@ -53,9 +53,6 @@ cropping and composing rectangles have the same

size.</para>

      </mediaobject>
        </figure>
Documentation/DocBook/media/v4l/selection-api.xml +0 -3
-For complete list of the available selection targets see table<xref
-linkend="v4l2-sel-target"/>
-
      </section>
 
    <section>
Documentation/DocBook/media/v4l/selections-common.xml new file +4 -0
new file mode 100644
index 0000000..e8f0b02
@@ -0,0 +1,92 @@
+<section id="v4l2-selections-common">
+
+<title>Selection targets</title>
+
Quoted 8 lines
Quoted 3 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +2 -0
+<para>While the V4L2<xref linkend="selection-api"/>  and V4L2
+  subdev<xref linkend="v4l2-subdev-selections"/>  selection APIs are

very

This sentence isn't quite correct. although I haven't looked myself how this could be improved, wouldn't it be there any way to use custom text for the hyperlink, not what get's pasted automatically ? It doesn't quite parse now.

I replaced that with <link linkend="selection-api">V4L2 selection API</link> and <link linkend="v4l2-subdev-selections">V4L2 subdev selection APIs</link>.

I updated the HTML documentation to reflect this.

Quoted 67 lines
Quoted 67 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +39 -0
+  similar, there's one fundamental difference between the two. On
+  sub-device API, the selection rectangle is refers to the media bus
+  format, and is bound to a sub-device and a pad. On the V4L2
+  interface the selection rectangles refer to the in-memory pixel
+  format and a video device's buffer queue.</para>
+
+<para>The meaning of the selection targets may thus be affected on
+  which of the two interfaces they are used.</para>
+
+<table pgwide="1" frame="none" id="v4l2-selection-targets-table">
+<title>Selection target definitions</title>
+<tgroup cols="4">
+<colspec colname="c1" />
+<colspec colname="c2" />
+<colspec colname="c3" />
+<colspec colname="c4" />
+<colspec colname="c5" />
+&cs-def;
+<thead>
+    <row rowsep="1">
+    <entry align="left">Target name</entry>
+    <entry align="left">id</entry>
+    <entry align="left">Definition</entry>
+    <entry align="left">Valid for V4L2</entry>
+    <entry align="left">Valid for V4L2 subdev</entry>
+    </row>
+</thead>
+<tbody valign="top">
+    <row>
+    <entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
+    <entry>0x0000</entry>
+    <entry>Crop rectangle. Defines the cropped area.</entry>
+    <entry>X</entry>
+    <entry>X</entry>
+    </row>
+    <row>
+<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
+<entry>0x0001</entry>
+<entry>Suggested cropping rectangle that covers the "whole

picture".</entry>

Documentation/DocBook/media/v4l/selections-common.xml new file +24 -0
+    <entry>X</entry>
+    <entry>O</entry>
+    </row>
+    <row>
+    <entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
+    <entry>0x0002</entry>
+    <entry>Bounds of the crop rectangle. All valid crop
+      rectangles fit inside the crop bounds rectangle.
+    </entry>
+    <entry>X</entry>
+    <entry>X</entry>
+    </row>
+    <row>
+    <entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
+    <entry>0x0100</entry>
+    <entry>Compose rectangle. Used to configure scaling
+      and composition.</entry>
+    <entry>X</entry>
+    <entry>X</entry>
+    </row>
+    <row>
+<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>
+<entry>0x0101</entry>
+<entry>Suggested composition rectangle that covers the "whole

picture".</entry>

Documentation/DocBook/media/v4l/selections-common.xml new file +2 -0
+    <entry>X</entry>
+    <entry>O</entry>
Quoted 8 lines

Documentation/DocBook/media/v4l/selections-common.xml line 77

Quoted 6 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +6 -0
+    </row>
+    <row>
+    <entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
+    <entry>0x0102</entry>
+    <entry>Bounds of the compose rectangle. All valid compose
+      rectangles fid inside the compose bounds rectangle.</entry>

typo ? s/fid/fit

Fixed.

Quoted 180 lines
Quoted 180 lines
Documentation/DocBook/media/v4l/selections-common.xml new file +15 -0
+    <entry>X</entry>
+    <entry>X</entry>
+    </row>
+    <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>X</entry>
+    <entry>O</entry>
+    </row>
+</tbody>
+</tgroup>
+</table>
+</section>
Documentation/DocBook/media/v4l/v4l2.xml +5 -0
index 015c561..87d0f4f 100644
@@ -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 +0 -0
index 6376e57..c6f8325 100644
@@ -67,7 +67,7 @@ Do not use multiplanar buffers.  Use<constant> 

V4L2_BUF_TYPE_VIDEO_CAPTURE
setting the value
of&v4l2-selection;<structfield>target</structfield> field
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
+linkend="v4l2-selections-common" /> 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
with zeros. The driver fills the rest of the structure or

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +0 -0
@@ -88,7 +88,7 @@ use multiplanar buffers.  Use<constant> 

V4L2_BUF_TYPE_VIDEO_CAPTURE
setting the value
of&v4l2-selection;<structfield>target</structfield> 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
+linkend="v4l2-selections-common" /> 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
</structfield> is ignored and must be filled with zeros. The
driver may adjust

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +0 -0
@@ -154,52 +154,8 @@ exist no rectangle</emphasis>  that satisfies the

constraints.</para>

    </refsect1>

-<refsect1>
-<table frame="none" pgwide="1" id="v4l2-sel-target"> -<title>Selection targets.</title>
-<tgroup cols="3">

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +0 -11
-    &cs-def;
-    <tbody valign="top">
-    <row>
-<entry><constant>V4L2_SEL_TGT_CROP</constant></entry>
-<entry>0x0000</entry>
-<entry>The area that is currently cropped by hardware.</entry>
-    </row>
-    <row>
-<entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry>
-<entry>0x0001</entry>
-<entry>Suggested cropping rectangle that covers the "whole

picture".</entry>

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +0 -15
-    </row>
-    <row>
-<entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry>
-<entry>0x0002</entry>
-<entry>Limits for the cropping rectangle.</entry>
-    </row>
-    <row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
-<entry>0x0100</entry>
-<entry>The area to which data is composed by hardware.</entry>
-    </row>
-    <row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry>
-<entry>0x0101</entry>
-<entry>Suggested composing rectangle that covers the "whole

picture".</entry>

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +2 -16
-    </row>
-    <row>
-<entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry>
-<entry>0x0102</entry>
-<entry>Limits for the composing rectangle.</entry>
-    </row>
-    <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>
-    </row>
-    </tbody>
-</tgroup>
-</table>
-</refsect1>
+<para>Selection targets are documented in<xref
+  linkend="v4l2-selections-common"/>.</para>
 
    <refsect1>
      <table frame="none" pgwide="1" id="v4l2-sel-flags">
@@ -253,7 +209,7 @@ exist no rectangle</emphasis>  that satisfies the

constraints.</para>

      <row>
      <entry>__u32</entry>
      <entry><structfield>target</structfield></entry>
-<entry>Used to select between<link linkend="v4l2-sel-target">  cropping
+<entry>Used to select between<link linkend="v4l2-selections-common"> 
cropping
          and composing rectangles</link>.</entry>
      </row>
      <row>

diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml index 96ab51e..fa4063a 100644

Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +0 -24
@@ -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>

Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +2 -6
-    <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>
Quoted 15 lines
Quoted 11 lines

<table pgwide="1" frame="none" id="v4l2-subdev-selection-flags">
<title>V4L2 subdev selection flags</title>

Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +1 -1
@@ -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 · 2 lines
Regards,
Sylwester

Kind regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#9 lore raw

PATCH v2 5/6 v4l: Unify selection flags

In reply to Sakari Ailus

Unify 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
index 82df7a0..f1220d3 100644
@@ -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
index 6fa70f4..99d5cc4 100644
@@ -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
index 09f0e30..e43be87 100644
@@ -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
index 1fe88eb..7530d17 100644
@@ -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
index 1d7d457..8c57ee9 100644
@@ -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
index 252f4b2..27da0c6 100644
@@ -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
#10 lore raw

PATCH v2 6/6 v4l: Unify selection flags documentation

In reply to Sakari Ailus

As 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  |    4 +-
 .../DocBook/media/v4l/selections-common.xml        |  221 +++++++++++++-------
 .../DocBook/media/v4l/vidioc-g-selection.xml       |   27 +---
 .../media/v4l/vidioc-subdev-g-selection.xml        |   39 +----
 5 files changed, 155 insertions(+), 142 deletions(-)
Documentation/DocBook/media/v4l/dev-subdev.xml +3 -3
index 76c4307..8c44b3f 100644
@@ -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 +2 -2
index d652a12..2de8b01 100644
@@ -71,7 +71,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>
 
@@ -114,7 +114,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 +146 -75

235 lines not on this page · raw message

Documentation/DocBook/media/v4l/vidioc-g-selection.xml +2 -25
index c6f8325..f76d8a6 100644
@@ -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
index fa4063a..9bc691e 100644
@@ -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 &lt;&lt; 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 &lt;&lt; 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 &lt;&lt; 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