Skip to contentSkip to conversation

v4l: introduce selection API

PATCH In review Tomasz Stanislawski 3 participants 3 messages Nov 14, 2011 – Dec 14, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l: introduce selection API

Hi Mauro,

This is the second 'pull-requested' version of the selection API. The patch-set introduces new ioctls to V4L2 API for the configuration of the selection rectangles like crop and compose areas.

Changelog:

- changed naming of constraints flags to form V4L2_SEL_FLAG_*
- changed naming of selection target to form V4L2_SEL_TGT_*
- size of PNG files in the documentation is greatly reduced
- fixes to handling of output queues for old cropping emulation
- VIDIOC_{S/G}_SELECTION for s5p-mixer accepts single- and multiplane buffers as VIDIOC_{S/G}_CROP did

Best regards,
Tomasz Stanislawski

The following changes since commit e9eb0dadba932940f721f9d27544a7818b2fa1c5:

[media] V4L menu: add submenu for platform devices (2011-11-08
12:09:52 -0200)

are available in the git repository at:
git://git.infradead.org/users/kmpark/linux-samsung v4l-selection

Tomasz Stanislawski (5):
v4l: add support for selection api
doc: v4l: add binary images for selection API
doc: v4l: add documentation for selection API
v4l: emulate old crop API using extended crop/compose API
v4l: s5p-tv: mixer: add support for selection API

 Documentation/DocBook/media/constraints.png.b64    |   59 ++++
 Documentation/DocBook/media/selection.png.b64      |  206 ++++++++++++
 Documentation/DocBook/media/v4l/common.xml         |    2 +
 Documentation/DocBook/media/v4l/compat.xml         |    9 +
 Documentation/DocBook/media/v4l/selection-api.xml  |  327 
+++++++++++++++++++
 Documentation/DocBook/media/v4l/v4l2.xml           |    1 +
 .../DocBook/media/v4l/vidioc-g-selection.xml       |  304 
+++++++++++++++++
 drivers/media/video/s5p-tv/mixer.h                 |   14 +-
 drivers/media/video/s5p-tv/mixer_grp_layer.c       |  157 +++++++--
 drivers/media/video/s5p-tv/mixer_video.c           |  342 
+++++++++++++-------
 drivers/media/video/s5p-tv/mixer_vp_layer.c        |  108 ++++---
 drivers/media/video/v4l2-compat-ioctl32.c          |    2 +
 drivers/media/video/v4l2-ioctl.c                   |  116 +++++++-
 include/linux/videodev2.h                          |   46 +++
 include/media/v4l2-ioctl.h                         |    4 +
 15 files changed, 1495 insertions(+), 202 deletions(-)
 create mode 100644 Documentation/DocBook/media/constraints.png.b64
 create mode 100644 Documentation/DocBook/media/selection.png.b64
 create mode 100644 Documentation/DocBook/media/v4l/selection-api.xml
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-selection.xml
#1 lore raw
Quoted 3 lines · Tomasz Stanislawski

Hi Mauro,

This is the second 'pull-requested' version of the selection API. The patch-set introduces new ioctls to V4L2 API for the configuration of the selection rectangles like crop and compose areas.

Tomasz,

A way better than the previous pull request. The only missing issue is related to the scaling. As I told you on IRC, the scale for it should be decided in advance, as a latter change would break binaries compiled with old Kernel versions.

So, we need to decide if the scale for cropping will be pixels or sub-pixels, or to add some flag that would allow userspace to decide between them.

PS.: As I've reviewed already the other patches, please add a new patch with the incremental change for scaling, as this saves my time to review the patches that are already ok.

Thanks,
Mauro

Quoted 51 lines

Changelog:

- changed naming of constraints flags to form V4L2_SEL_FLAG_*
- changed naming of selection target to form V4L2_SEL_TGT_*
- size of PNG files in the documentation is greatly reduced
- fixes to handling of output queues for old cropping emulation
- VIDIOC_{S/G}_SELECTION for s5p-mixer accepts single- and multiplane buffers as VIDIOC_{S/G}_CROP did

Best regards,
Tomasz Stanislawski

The following changes since commit e9eb0dadba932940f721f9d27544a7818b2fa1c5:

[media] V4L menu: add submenu for platform devices (2011-11-08 12:09:52 -0200)

are available in the git repository at:
git://git.infradead.org/users/kmpark/linux-samsung v4l-selection

Tomasz Stanislawski (5):
v4l: add support for selection api
doc: v4l: add binary images for selection API
doc: v4l: add documentation for selection API
v4l: emulate old crop API using extended crop/compose API
v4l: s5p-tv: mixer: add support for selection API

Documentation/DocBook/media/constraints.png.b64 | 59 ++++ Documentation/DocBook/media/selection.png.b64 | 206 ++++++++++++ Documentation/DocBook/media/v4l/common.xml | 2 + Documentation/DocBook/media/v4l/compat.xml | 9 + Documentation/DocBook/media/v4l/selection-api.xml | 327 +++++++++++++++++++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + .../DocBook/media/v4l/vidioc-g-selection.xml | 304 +++++++++++++++++ drivers/media/video/s5p-tv/mixer.h | 14 +- drivers/media/video/s5p-tv/mixer_grp_layer.c | 157 +++++++-- drivers/media/video/s5p-tv/mixer_video.c | 342 +++++++++++++------- drivers/media/video/s5p-tv/mixer_vp_layer.c | 108 ++++--- drivers/media/video/v4l2-compat-ioctl32.c | 2 + drivers/media/video/v4l2-ioctl.c | 116 +++++++- include/linux/videodev2.h | 46 +++
include/media/v4l2-ioctl.h | 4 +

15 files changed, 1495 insertions(+), 202 deletions(-)

create mode 100644 Documentation/DocBook/media/constraints.png.b64 create mode 100644 Documentation/DocBook/media/selection.png.b64 create mode 100644 Documentation/DocBook/media/v4l/selection-api.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-selection.xml

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/1 doc: v4l: selection: choose pixels as units for selection rectangles

From: Tomasz Stanislawski <[email protected]>

Pixels were preferred units for selection rectangles over driver-dependent units for almost all use cases. Therefore the units were fixed to pixels.

---
 Documentation/DocBook/media/v4l/selection-api.xml |   30 ++++++++------------
 1 files changed, 12 insertions(+), 18 deletions(-)
Documentation/DocBook/media/v4l/selection-api.xml +12 -18
index 46cb47a..2f0bdb4 100644
@@ -84,9 +84,7 @@ configure the cropping targets before to the composing targets.</para>
 areas that can be sampled is given by the <constant> V4L2_SEL_TGT_CROP_BOUNDS
 </constant> target. It is recommended for the driver developers to put the
 top/left corner at position <constant> (0,0) </constant>.  The rectangle's
-coordinates are expressed in driver dependant units, although the coordinate
-system guarantees that if sizes of the active cropping and the active composing
-rectangles are equal then no scaling is performed.  </para>
+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
@@ -103,10 +101,10 @@ not later.</para>
 
 <para>The composing targets refer to a memory buffer. The limits of composing
 coordinates are obtained using <constant> V4L2_SEL_TGT_COMPOSE_BOUNDS
-</constant>.  All coordinates are expressed in natural unit for given formats.
-Pixels are highly recommended.  The rectangle's top/left corner must be located
-at position <constant> (0,0) </constant>. The width and height are equal to the
-image size set by <constant> VIDIOC_S_FMT </constant>.</para>
+</constant>.  All coordinates are expressed in pixels. The rectangle's top/left
+corner must be located at position <constant> (0,0) </constant>. The width and
+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.
@@ -145,10 +143,9 @@ the cropping targets.</para>
 <para>The cropping targets refer to the memory buffer that contains an image to
 be inserted into a video signal or graphical screen. The limits of cropping
 coordinates are obtained using <constant> V4L2_SEL_TGT_CROP_BOUNDS </constant>.
-All coordinates are expressed in natural units for a given format. Pixels are
-highly recommended.  The top/left corner is always point <constant> (0,0)
-</constant>.  The width and height is equal to the image size specified using
-<constant> VIDIOC_S_FMT </constant> ioctl.</para>
+All coordinates are expressed in pixels. The top/left corner is always point
+<constant> (0,0) </constant>.  The width and height is equal to the image size
+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
@@ -163,13 +160,10 @@ limitations.</para>
 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 are expressed in driver
-dependant units. The only exception are digital outputs where the units are
-pixels. For other types of devices, the coordinate system guarantees that if
-sizes of the active cropping and the active composing rectangles are equal then
-no scaling is performed.  The composing rectangle must lie completely inside
-the bounds rectangle.  The driver must adjust the area to fit to the bounding
+inserted by the hardware is controlled by <constant>
+V4L2_SEL_TGT_COMPOSE_ACTIVE </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
 hardware limitations. </para>
 
Signature · 1 line
1.7.1.569.g6f426