Common selection definitionsWhile the V4L2 selection
API and V4L2 subdev
selection APIs are very similar, there's one fundamental
difference between the two. On sub-device API, the selection
rectangle refers to the media bus format, and is bound to a
sub-device's pad. On the V4L2 interface the selection rectangles
refer to the in-memory pixel format.This section defines the common definitions of the
selection interfaces on the two APIs.Selection targetsThe precise meaning of the selection targets may be
dependent on which of the two interfaces they are used.
Selection target definitions
&cs-def;
Target nameidDefinitionValid for V4L2Valid for V4L2 subdevV4L2_SEL_TGT_CROP0x0000Crop rectangle. Defines the cropped area.YesYesV4L2_SEL_TGT_CROP_DEFAULT0x0001Suggested cropping rectangle that covers the "whole picture".YesNoV4L2_SEL_TGT_CROP_BOUNDS0x0002Bounds of the crop rectangle. All valid crop
rectangles fit inside the crop bounds rectangle.
YesYesV4L2_SEL_TGT_NATIVE_SIZE0x0003The native size of the device, e.g. a sensor's
pixel array. left and
top fields are zero for this
target. Setting the native size will generally only make
sense for memory to memory devices where the software can
create a canvas of a given size in which for example a
video frame can be composed. In that case
V4L2_SEL_TGT_NATIVE_SIZE can be used to configure the size
of that canvas.
YesYesV4L2_SEL_TGT_COMPOSE0x0100Compose rectangle. Used to configure scaling
and composition.YesYesV4L2_SEL_TGT_COMPOSE_DEFAULT0x0101Suggested composition rectangle that covers the "whole picture".YesNoV4L2_SEL_TGT_COMPOSE_BOUNDS0x0102Bounds of the compose rectangle. All valid compose
rectangles fit inside the compose bounds rectangle.YesYesV4L2_SEL_TGT_COMPOSE_PADDED0x0103The active area and all padding pixels that are inserted or
modified by hardware.YesNo
Selection flags
Selection flag definitions
&cs-def;
Flag nameidDefinitionValid for V4L2Valid for V4L2 subdevV4L2_SEL_FLAG_GE(1 << 0)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
V4L2_SEL_FLAG_LE) the
behaviour is to choose the closest possible
rectangle.YesYesV4L2_SEL_FLAG_LE(1 << 1)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.YesYesV4L2_SEL_FLAG_KEEP_CONFIG(1 << 2)The configuration must 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.NoYes