v4l2_test: reset rotate to ROTATE_NONE on application launch
Start the application with a well known rotation value that works with all the resolutions. Otherwise the rotation value is unknown because it could have been changed in a previous run of the application. Also in the kernel driver support was added to report EINVAL to user-space in case the requested rotation is not supported. We use that to not return from the 'v4l2_rotate' function without enabling again the overlay preview. https://jira.digi.com/browse/DEL-1068 https://jira.digi.com/browse/DEL-1205 Signed-off-by: Javier Viguera <javier.viguera@digi.com> (cherry picked from commit 2f7547a1b810683b813b708ba67e53ba156a9337)
This commit is contained in:
parent
45de4d6943
commit
bbb2758a79
|
|
@ -714,9 +714,14 @@ int v4l2_get_control(int fd, int id, int *value)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int v4l2_rotate(int fd, int rotate)
|
int v4l2_set_rotate(int fd, int rotate)
|
||||||
{
|
{
|
||||||
/* This is not supported by V4L2, it's done by the IPUv3 driver */
|
/* This is not supported by V4L2, it's done by the IPUv3 driver */
|
||||||
|
return v4l2_set_control(fd, V4L2_CID_MXC_VF_ROT, rotate);
|
||||||
|
}
|
||||||
|
|
||||||
|
int v4l2_rotate(int fd, int rotate)
|
||||||
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* Stop overlay */
|
/* Stop overlay */
|
||||||
|
|
@ -725,15 +730,12 @@ int v4l2_rotate(int fd, int rotate)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
/* Set new rotation value */
|
/* Set new rotation value */
|
||||||
retval = v4l2_set_control(fd, V4L2_CID_MXC_VF_ROT, rotate);
|
retval = v4l2_set_rotate(fd, rotate);
|
||||||
if (retval < 0)
|
if (retval < 0 && errno != EINVAL)
|
||||||
return retval;
|
|
||||||
/* Start overlay */
|
|
||||||
retval = v4l2_overlay_control(fd, 1);
|
|
||||||
if (retval < 1)
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
return retval;
|
/* Start overlay */
|
||||||
|
return v4l2_overlay_control(fd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int v4l2_set_brightness(int fd, int percentage)
|
int v4l2_set_brightness(int fd, int percentage)
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ int v4l2_reset_cropping_rectangle(int fd);
|
||||||
int v4l2_fb_blank(int fd);
|
int v4l2_fb_blank(int fd);
|
||||||
int v4l2_fb_unblank(int fd);
|
int v4l2_fb_unblank(int fd);
|
||||||
int v4l2_zoom(int fd, int zoom);
|
int v4l2_zoom(int fd, int zoom);
|
||||||
|
int v4l2_set_rotate(int fd, int rotate);
|
||||||
int v4l2_rotate(int fd, int rotate);
|
int v4l2_rotate(int fd, int rotate);
|
||||||
int v4l2_crop_input(int fd, struct v4l2_rect *crop_rectangle);
|
int v4l2_crop_input(int fd, struct v4l2_rect *crop_rectangle);
|
||||||
int v4l2_get_cropping_limits(int fd, struct v4l2_rect *limits);
|
int v4l2_get_cropping_limits(int fd, struct v4l2_rect *limits);
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,9 @@ static void *v4l2_camera_thread(void *pargs)
|
||||||
/* Restore default cropping - no zoom */
|
/* Restore default cropping - no zoom */
|
||||||
v4l2_reset_cropping_rectangle(args->fd_in);
|
v4l2_reset_cropping_rectangle(args->fd_in);
|
||||||
|
|
||||||
|
/* Reset rotation to ROTATE_NONE */
|
||||||
|
v4l2_set_rotate(args->fd_in, 0);
|
||||||
|
|
||||||
/* Set size in overlay */
|
/* Set size in overlay */
|
||||||
v4l2_set_format_overlay(args->fd_in,
|
v4l2_set_format_overlay(args->fd_in,
|
||||||
args->options.top, args->options.left,
|
args->options.top, args->options.left,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue