[media] videodev2: Set vb2_rect's width and height as unsigned
As discussed on the media summit 2013, there is no reason for the width and height to be signed. Therefore this patch is an attempt to convert those fields from __s32 to __u32. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> (documentation and smiapp) Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
da4a733946
commit
f90580ca01
|
@ -2523,6 +2523,18 @@ that used it. It was originally scheduled for removal in 2.6.35.
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<title>V4L2 in Linux 3.14</title>
|
||||||
|
<orderedlist>
|
||||||
|
<listitem>
|
||||||
|
<para> In struct <structname>v4l2_rect</structname>, the type
|
||||||
|
of <structfield>width</structfield> and <structfield>height</structfield>
|
||||||
|
fields changed from _s32 to _u32.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</orderedlist>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section id="other">
|
<section id="other">
|
||||||
<title>Relation of V4L2 to other Linux multimedia APIs</title>
|
<title>Relation of V4L2 to other Linux multimedia APIs</title>
|
||||||
|
|
||||||
|
|
|
@ -346,17 +346,14 @@ rectangle, in pixels.</entry>
|
||||||
rectangle, in pixels. Offsets increase to the right and down.</entry>
|
rectangle, in pixels. Offsets increase to the right and down.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>__s32</entry>
|
<entry>__u32</entry>
|
||||||
<entry><structfield>width</structfield></entry>
|
<entry><structfield>width</structfield></entry>
|
||||||
<entry>Width of the rectangle, in pixels.</entry>
|
<entry>Width of the rectangle, in pixels.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>__s32</entry>
|
<entry>__u32</entry>
|
||||||
<entry><structfield>height</structfield></entry>
|
<entry><structfield>height</structfield></entry>
|
||||||
<entry>Height of the rectangle, in pixels. Width and
|
<entry>Height of the rectangle, in pixels.</entry>
|
||||||
height cannot be negative, the fields are signed for hysterical
|
|
||||||
reasons. <!-- video4linux-list@redhat.com on 22 Oct 2002 subject
|
|
||||||
"Re:[V4L][patches!] Re:v4l2/kernel-2.5" --></entry>
|
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
|
|
|
@ -140,6 +140,14 @@ structs, ioctls) must be noted in more detail in the history chapter
|
||||||
(compat.xml), along with the possible impact on existing drivers and
|
(compat.xml), along with the possible impact on existing drivers and
|
||||||
applications. -->
|
applications. -->
|
||||||
|
|
||||||
|
<revision>
|
||||||
|
<revnumber>3.14</revnumber>
|
||||||
|
<date>2013-11-25</date>
|
||||||
|
<authorinitials>rr</authorinitials>
|
||||||
|
<revremark>Set width and height as unsigned on v4l2_rect.
|
||||||
|
</revremark>
|
||||||
|
</revision>
|
||||||
|
|
||||||
<revision>
|
<revision>
|
||||||
<revnumber>3.11</revnumber>
|
<revnumber>3.11</revnumber>
|
||||||
<date>2013-05-26</date>
|
<date>2013-05-26</date>
|
||||||
|
@ -501,7 +509,7 @@ and discussions on the V4L mailing list.</revremark>
|
||||||
</partinfo>
|
</partinfo>
|
||||||
|
|
||||||
<title>Video for Linux Two API Specification</title>
|
<title>Video for Linux Two API Specification</title>
|
||||||
<subtitle>Revision 3.11</subtitle>
|
<subtitle>Revision 3.14</subtitle>
|
||||||
|
|
||||||
<chapter id="common">
|
<chapter id="common">
|
||||||
&sub-common;
|
&sub-common;
|
||||||
|
|
|
@ -133,18 +133,14 @@ rectangle, in pixels.</entry>
|
||||||
rectangle, in pixels.</entry>
|
rectangle, in pixels.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>__s32</entry>
|
<entry>__u32</entry>
|
||||||
<entry><structfield>width</structfield></entry>
|
<entry><structfield>width</structfield></entry>
|
||||||
<entry>Width of the rectangle, in pixels.</entry>
|
<entry>Width of the rectangle, in pixels.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>__s32</entry>
|
<entry>__u32</entry>
|
||||||
<entry><structfield>height</structfield></entry>
|
<entry><structfield>height</structfield></entry>
|
||||||
<entry>Height of the rectangle, in pixels. Width
|
<entry>Height of the rectangle, in pixels.</entry>
|
||||||
and height cannot be negative, the fields are signed for
|
|
||||||
hysterical reasons. <!-- video4linux-list@redhat.com
|
|
||||||
on 22 Oct 2002 subject "Re:[V4L][patches!] Re:v4l2/kernel-2.5" -->
|
|
||||||
</entry>
|
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
|
|
|
@ -459,13 +459,15 @@ static int mt9m032_set_pad_crop(struct v4l2_subdev *subdev,
|
||||||
MT9M032_COLUMN_START_MAX);
|
MT9M032_COLUMN_START_MAX);
|
||||||
rect.top = clamp(ALIGN(crop->rect.top, 2), MT9M032_ROW_START_MIN,
|
rect.top = clamp(ALIGN(crop->rect.top, 2), MT9M032_ROW_START_MIN,
|
||||||
MT9M032_ROW_START_MAX);
|
MT9M032_ROW_START_MAX);
|
||||||
rect.width = clamp(ALIGN(crop->rect.width, 2), MT9M032_COLUMN_SIZE_MIN,
|
rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
|
||||||
MT9M032_COLUMN_SIZE_MAX);
|
MT9M032_COLUMN_SIZE_MIN, MT9M032_COLUMN_SIZE_MAX);
|
||||||
rect.height = clamp(ALIGN(crop->rect.height, 2), MT9M032_ROW_SIZE_MIN,
|
rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
|
||||||
MT9M032_ROW_SIZE_MAX);
|
MT9M032_ROW_SIZE_MIN, MT9M032_ROW_SIZE_MAX);
|
||||||
|
|
||||||
rect.width = min(rect.width, MT9M032_PIXEL_ARRAY_WIDTH - rect.left);
|
rect.width = min_t(unsigned int, rect.width,
|
||||||
rect.height = min(rect.height, MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);
|
MT9M032_PIXEL_ARRAY_WIDTH - rect.left);
|
||||||
|
rect.height = min_t(unsigned int, rect.height,
|
||||||
|
MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);
|
||||||
|
|
||||||
__crop = __mt9m032_get_pad_crop(sensor, fh, crop->which);
|
__crop = __mt9m032_get_pad_crop(sensor, fh, crop->which);
|
||||||
|
|
||||||
|
|
|
@ -519,11 +519,13 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
|
||||||
|
|
||||||
/* Clamp the width and height to avoid dividing by zero. */
|
/* Clamp the width and height to avoid dividing by zero. */
|
||||||
width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
|
width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
|
||||||
max(__crop->width / 7, MT9P031_WINDOW_WIDTH_MIN),
|
max_t(unsigned int, __crop->width / 7,
|
||||||
|
MT9P031_WINDOW_WIDTH_MIN),
|
||||||
__crop->width);
|
__crop->width);
|
||||||
height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
|
height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
|
||||||
max(__crop->height / 8, MT9P031_WINDOW_HEIGHT_MIN),
|
max_t(unsigned int, __crop->height / 8,
|
||||||
__crop->height);
|
MT9P031_WINDOW_HEIGHT_MIN),
|
||||||
|
__crop->height);
|
||||||
|
|
||||||
hratio = DIV_ROUND_CLOSEST(__crop->width, width);
|
hratio = DIV_ROUND_CLOSEST(__crop->width, width);
|
||||||
vratio = DIV_ROUND_CLOSEST(__crop->height, height);
|
vratio = DIV_ROUND_CLOSEST(__crop->height, height);
|
||||||
|
@ -565,15 +567,17 @@ static int mt9p031_set_crop(struct v4l2_subdev *subdev,
|
||||||
MT9P031_COLUMN_START_MAX);
|
MT9P031_COLUMN_START_MAX);
|
||||||
rect.top = clamp(ALIGN(crop->rect.top, 2), MT9P031_ROW_START_MIN,
|
rect.top = clamp(ALIGN(crop->rect.top, 2), MT9P031_ROW_START_MIN,
|
||||||
MT9P031_ROW_START_MAX);
|
MT9P031_ROW_START_MAX);
|
||||||
rect.width = clamp(ALIGN(crop->rect.width, 2),
|
rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
|
||||||
MT9P031_WINDOW_WIDTH_MIN,
|
MT9P031_WINDOW_WIDTH_MIN,
|
||||||
MT9P031_WINDOW_WIDTH_MAX);
|
MT9P031_WINDOW_WIDTH_MAX);
|
||||||
rect.height = clamp(ALIGN(crop->rect.height, 2),
|
rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
|
||||||
MT9P031_WINDOW_HEIGHT_MIN,
|
MT9P031_WINDOW_HEIGHT_MIN,
|
||||||
MT9P031_WINDOW_HEIGHT_MAX);
|
MT9P031_WINDOW_HEIGHT_MAX);
|
||||||
|
|
||||||
rect.width = min(rect.width, MT9P031_PIXEL_ARRAY_WIDTH - rect.left);
|
rect.width = min_t(unsigned int, rect.width,
|
||||||
rect.height = min(rect.height, MT9P031_PIXEL_ARRAY_HEIGHT - rect.top);
|
MT9P031_PIXEL_ARRAY_WIDTH - rect.left);
|
||||||
|
rect.height = min_t(unsigned int, rect.height,
|
||||||
|
MT9P031_PIXEL_ARRAY_HEIGHT - rect.top);
|
||||||
|
|
||||||
__crop = __mt9p031_get_pad_crop(mt9p031, fh, crop->pad, crop->which);
|
__crop = __mt9p031_get_pad_crop(mt9p031, fh, crop->pad, crop->which);
|
||||||
|
|
||||||
|
|
|
@ -291,10 +291,12 @@ static int mt9t001_set_format(struct v4l2_subdev *subdev,
|
||||||
|
|
||||||
/* Clamp the width and height to avoid dividing by zero. */
|
/* Clamp the width and height to avoid dividing by zero. */
|
||||||
width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
|
width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
|
||||||
max(__crop->width / 8, MT9T001_WINDOW_HEIGHT_MIN + 1),
|
max_t(unsigned int, __crop->width / 8,
|
||||||
|
MT9T001_WINDOW_HEIGHT_MIN + 1),
|
||||||
__crop->width);
|
__crop->width);
|
||||||
height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
|
height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
|
||||||
max(__crop->height / 8, MT9T001_WINDOW_HEIGHT_MIN + 1),
|
max_t(unsigned int, __crop->height / 8,
|
||||||
|
MT9T001_WINDOW_HEIGHT_MIN + 1),
|
||||||
__crop->height);
|
__crop->height);
|
||||||
|
|
||||||
hratio = DIV_ROUND_CLOSEST(__crop->width, width);
|
hratio = DIV_ROUND_CLOSEST(__crop->width, width);
|
||||||
|
@ -339,15 +341,17 @@ static int mt9t001_set_crop(struct v4l2_subdev *subdev,
|
||||||
rect.top = clamp(ALIGN(crop->rect.top, 2),
|
rect.top = clamp(ALIGN(crop->rect.top, 2),
|
||||||
MT9T001_ROW_START_MIN,
|
MT9T001_ROW_START_MIN,
|
||||||
MT9T001_ROW_START_MAX);
|
MT9T001_ROW_START_MAX);
|
||||||
rect.width = clamp(ALIGN(crop->rect.width, 2),
|
rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
|
||||||
MT9T001_WINDOW_WIDTH_MIN + 1,
|
MT9T001_WINDOW_WIDTH_MIN + 1,
|
||||||
MT9T001_WINDOW_WIDTH_MAX + 1);
|
MT9T001_WINDOW_WIDTH_MAX + 1);
|
||||||
rect.height = clamp(ALIGN(crop->rect.height, 2),
|
rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
|
||||||
MT9T001_WINDOW_HEIGHT_MIN + 1,
|
MT9T001_WINDOW_HEIGHT_MIN + 1,
|
||||||
MT9T001_WINDOW_HEIGHT_MAX + 1);
|
MT9T001_WINDOW_HEIGHT_MAX + 1);
|
||||||
|
|
||||||
rect.width = min(rect.width, MT9T001_PIXEL_ARRAY_WIDTH - rect.left);
|
rect.width = min_t(unsigned int, rect.width,
|
||||||
rect.height = min(rect.height, MT9T001_PIXEL_ARRAY_HEIGHT - rect.top);
|
MT9T001_PIXEL_ARRAY_WIDTH - rect.left);
|
||||||
|
rect.height = min_t(unsigned int, rect.height,
|
||||||
|
MT9T001_PIXEL_ARRAY_HEIGHT - rect.top);
|
||||||
|
|
||||||
__crop = __mt9t001_get_pad_crop(mt9t001, fh, crop->pad, crop->which);
|
__crop = __mt9t001_get_pad_crop(mt9t001, fh, crop->pad, crop->which);
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032)
|
||||||
|
|
||||||
if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
|
if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
|
||||||
min_hblank += (mt9v032->hratio - 1) * 10;
|
min_hblank += (mt9v032->hratio - 1) * 10;
|
||||||
min_hblank = max((int)mt9v032->model->data->min_row_time - crop->width,
|
min_hblank = max_t(unsigned int, (int)mt9v032->model->data->min_row_time - crop->width,
|
||||||
(int)min_hblank);
|
(int)min_hblank);
|
||||||
hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
|
hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
|
||||||
|
|
||||||
return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);
|
return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);
|
||||||
|
@ -525,12 +525,14 @@ static int mt9v032_set_format(struct v4l2_subdev *subdev,
|
||||||
format->which);
|
format->which);
|
||||||
|
|
||||||
/* Clamp the width and height to avoid dividing by zero. */
|
/* Clamp the width and height to avoid dividing by zero. */
|
||||||
width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
|
width = clamp(ALIGN(format->format.width, 2),
|
||||||
max(__crop->width / 4, MT9V032_WINDOW_WIDTH_MIN),
|
max_t(unsigned int, __crop->width / 4,
|
||||||
__crop->width);
|
MT9V032_WINDOW_WIDTH_MIN),
|
||||||
height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
|
__crop->width);
|
||||||
max(__crop->height / 4, MT9V032_WINDOW_HEIGHT_MIN),
|
height = clamp(ALIGN(format->format.height, 2),
|
||||||
__crop->height);
|
max_t(unsigned int, __crop->height / 4,
|
||||||
|
MT9V032_WINDOW_HEIGHT_MIN),
|
||||||
|
__crop->height);
|
||||||
|
|
||||||
hratio = mt9v032_calc_ratio(__crop->width, width);
|
hratio = mt9v032_calc_ratio(__crop->width, width);
|
||||||
vratio = mt9v032_calc_ratio(__crop->height, height);
|
vratio = mt9v032_calc_ratio(__crop->height, height);
|
||||||
|
@ -580,15 +582,17 @@ static int mt9v032_set_crop(struct v4l2_subdev *subdev,
|
||||||
rect.top = clamp(ALIGN(crop->rect.top + 1, 2) - 1,
|
rect.top = clamp(ALIGN(crop->rect.top + 1, 2) - 1,
|
||||||
MT9V032_ROW_START_MIN,
|
MT9V032_ROW_START_MIN,
|
||||||
MT9V032_ROW_START_MAX);
|
MT9V032_ROW_START_MAX);
|
||||||
rect.width = clamp(ALIGN(crop->rect.width, 2),
|
rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
|
||||||
MT9V032_WINDOW_WIDTH_MIN,
|
MT9V032_WINDOW_WIDTH_MIN,
|
||||||
MT9V032_WINDOW_WIDTH_MAX);
|
MT9V032_WINDOW_WIDTH_MAX);
|
||||||
rect.height = clamp(ALIGN(crop->rect.height, 2),
|
rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
|
||||||
MT9V032_WINDOW_HEIGHT_MIN,
|
MT9V032_WINDOW_HEIGHT_MIN,
|
||||||
MT9V032_WINDOW_HEIGHT_MAX);
|
MT9V032_WINDOW_HEIGHT_MAX);
|
||||||
|
|
||||||
rect.width = min(rect.width, MT9V032_PIXEL_ARRAY_WIDTH - rect.left);
|
rect.width = min_t(unsigned int,
|
||||||
rect.height = min(rect.height, MT9V032_PIXEL_ARRAY_HEIGHT - rect.top);
|
rect.width, MT9V032_PIXEL_ARRAY_WIDTH - rect.left);
|
||||||
|
rect.height = min_t(unsigned int,
|
||||||
|
rect.height, MT9V032_PIXEL_ARRAY_HEIGHT - rect.top);
|
||||||
|
|
||||||
__crop = __mt9v032_get_pad_crop(mt9v032, fh, crop->pad, crop->which);
|
__crop = __mt9v032_get_pad_crop(mt9v032, fh, crop->pad, crop->which);
|
||||||
|
|
||||||
|
|
|
@ -2027,8 +2027,8 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
|
||||||
sel->r.width = min(sel->r.width, src_size->width);
|
sel->r.width = min(sel->r.width, src_size->width);
|
||||||
sel->r.height = min(sel->r.height, src_size->height);
|
sel->r.height = min(sel->r.height, src_size->height);
|
||||||
|
|
||||||
sel->r.left = min(sel->r.left, src_size->width - sel->r.width);
|
sel->r.left = min_t(int, sel->r.left, src_size->width - sel->r.width);
|
||||||
sel->r.top = min(sel->r.top, src_size->height - sel->r.height);
|
sel->r.top = min_t(int, sel->r.top, src_size->height - sel->r.height);
|
||||||
|
|
||||||
*crops[sel->pad] = sel->r;
|
*crops[sel->pad] = sel->r;
|
||||||
|
|
||||||
|
@ -2120,8 +2120,8 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
|
||||||
|
|
||||||
sel->r.left = max(0, sel->r.left & ~1);
|
sel->r.left = max(0, sel->r.left & ~1);
|
||||||
sel->r.top = max(0, sel->r.top & ~1);
|
sel->r.top = max(0, sel->r.top & ~1);
|
||||||
sel->r.width = max(0, SMIAPP_ALIGN_DIM(sel->r.width, sel->flags));
|
sel->r.width = SMIAPP_ALIGN_DIM(sel->r.width, sel->flags);
|
||||||
sel->r.height = max(0, SMIAPP_ALIGN_DIM(sel->r.height, sel->flags));
|
sel->r.height = SMIAPP_ALIGN_DIM(sel->r.height, sel->flags);
|
||||||
|
|
||||||
sel->r.width = max_t(unsigned int,
|
sel->r.width = max_t(unsigned int,
|
||||||
sensor->limits[SMIAPP_LIMIT_MIN_X_OUTPUT_SIZE],
|
sensor->limits[SMIAPP_LIMIT_MIN_X_OUTPUT_SIZE],
|
||||||
|
|
|
@ -208,8 +208,8 @@ struct mt9m111 {
|
||||||
struct mt9m111_context *ctx;
|
struct mt9m111_context *ctx;
|
||||||
struct v4l2_rect rect; /* cropping rectangle */
|
struct v4l2_rect rect; /* cropping rectangle */
|
||||||
struct v4l2_clk *clk;
|
struct v4l2_clk *clk;
|
||||||
int width; /* output */
|
unsigned int width; /* output */
|
||||||
int height; /* sizes */
|
unsigned int height; /* sizes */
|
||||||
struct mutex power_lock; /* lock to protect power_count */
|
struct mutex power_lock; /* lock to protect power_count */
|
||||||
int power_count;
|
int power_count;
|
||||||
const struct mt9m111_datafmt *fmt;
|
const struct mt9m111_datafmt *fmt;
|
||||||
|
|
|
@ -863,7 +863,7 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
|
||||||
struct v4l2_rect rect = a->c;
|
struct v4l2_rect rect = a->c;
|
||||||
struct tvp5150 *decoder = to_tvp5150(sd);
|
struct tvp5150 *decoder = to_tvp5150(sd);
|
||||||
v4l2_std_id std;
|
v4l2_std_id std;
|
||||||
int hmax;
|
unsigned int hmax;
|
||||||
|
|
||||||
v4l2_dbg(1, debug, sd, "%s left=%d, top=%d, width=%d, height=%d\n",
|
v4l2_dbg(1, debug, sd, "%s left=%d, top=%d, width=%d, height=%d\n",
|
||||||
__func__, rect.left, rect.top, rect.width, rect.height);
|
__func__, rect.left, rect.top, rect.width, rect.height);
|
||||||
|
@ -873,9 +873,9 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
|
||||||
|
|
||||||
/* tvp5150 has some special limits */
|
/* tvp5150 has some special limits */
|
||||||
rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
|
rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
|
||||||
rect.width = clamp(rect.width,
|
rect.width = clamp_t(unsigned int, rect.width,
|
||||||
TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
|
TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
|
||||||
TVP5150_H_MAX - rect.left);
|
TVP5150_H_MAX - rect.left);
|
||||||
rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
|
rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
|
||||||
|
|
||||||
/* Calculate height based on current standard */
|
/* Calculate height based on current standard */
|
||||||
|
@ -889,9 +889,9 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
|
||||||
else
|
else
|
||||||
hmax = TVP5150_V_MAX_OTHERS;
|
hmax = TVP5150_V_MAX_OTHERS;
|
||||||
|
|
||||||
rect.height = clamp(rect.height,
|
rect.height = clamp_t(unsigned int, rect.height,
|
||||||
hmax - TVP5150_MAX_CROP_TOP - rect.top,
|
hmax - TVP5150_MAX_CROP_TOP - rect.top,
|
||||||
hmax - rect.top);
|
hmax - rect.top);
|
||||||
|
|
||||||
tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
|
tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
|
||||||
tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
|
tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
|
||||||
|
|
|
@ -1126,9 +1126,9 @@ bttv_crop_calc_limits(struct bttv_crop *c)
|
||||||
c->min_scaled_height = 32;
|
c->min_scaled_height = 32;
|
||||||
} else {
|
} else {
|
||||||
c->min_scaled_width =
|
c->min_scaled_width =
|
||||||
(max(48, c->rect.width >> 4) + 3) & ~3;
|
(max_t(unsigned int, 48, c->rect.width >> 4) + 3) & ~3;
|
||||||
c->min_scaled_height =
|
c->min_scaled_height =
|
||||||
max(32, c->rect.height >> 4);
|
max_t(unsigned int, 32, c->rect.height >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
c->max_scaled_width = c->rect.width & ~3;
|
c->max_scaled_width = c->rect.width & ~3;
|
||||||
|
@ -2024,7 +2024,7 @@ limit_scaled_size_lock (struct bttv_fh * fh,
|
||||||
/* We cannot scale up. When the scaled image is larger
|
/* We cannot scale up. When the scaled image is larger
|
||||||
than crop.rect we adjust the crop.rect as required
|
than crop.rect we adjust the crop.rect as required
|
||||||
by the V4L2 spec, hence cropcap.bounds are our limit. */
|
by the V4L2 spec, hence cropcap.bounds are our limit. */
|
||||||
max_width = min(b->width, (__s32) MAX_HACTIVE);
|
max_width = min_t(unsigned int, b->width, MAX_HACTIVE);
|
||||||
max_height = b->height;
|
max_height = b->height;
|
||||||
|
|
||||||
/* We cannot capture the same line as video and VBI data.
|
/* We cannot capture the same line as video and VBI data.
|
||||||
|
|
|
@ -1729,10 +1729,6 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr
|
||||||
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
||||||
crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (crop->c.height < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
if (crop->c.width < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (res_locked(dev, RESOURCE_OVERLAY))
|
if (res_locked(dev, RESOURCE_OVERLAY))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
|
@ -141,8 +141,8 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd,
|
||||||
* Popular special case - some cameras can only handle fixed sizes like
|
* Popular special case - some cameras can only handle fixed sizes like
|
||||||
* QVGA, VGA,... Take care to avoid infinite loop.
|
* QVGA, VGA,... Take care to avoid infinite loop.
|
||||||
*/
|
*/
|
||||||
width = max(cam_rect->width, 2);
|
width = max_t(unsigned int, cam_rect->width, 2);
|
||||||
height = max(cam_rect->height, 2);
|
height = max_t(unsigned int, cam_rect->height, 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop as long as sensor is not covering the requested rectangle and
|
* Loop as long as sensor is not covering the requested rectangle and
|
||||||
|
|
|
@ -207,8 +207,8 @@ enum v4l2_priority {
|
||||||
struct v4l2_rect {
|
struct v4l2_rect {
|
||||||
__s32 left;
|
__s32 left;
|
||||||
__s32 top;
|
__s32 top;
|
||||||
__s32 width;
|
__u32 width;
|
||||||
__s32 height;
|
__u32 height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct v4l2_fract {
|
struct v4l2_fract {
|
||||||
|
|
Loading…
Reference in a new issue