[media] media: davinci: vpbe: use helpers provided by core if streaming is started
this patch uses vb2_is_busy() helper to check if streaming is actually started, instead of driver managing it. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
c24376f302
commit
1b73f03cbf
|
@ -152,8 +152,8 @@ static irqreturn_t venc_isr(int irq, void *arg)
|
||||||
|
|
||||||
for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
|
for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
|
||||||
layer = disp_dev->dev[i];
|
layer = disp_dev->dev[i];
|
||||||
/* If streaming is started in this layer */
|
|
||||||
if (!layer->started)
|
if (!vb2_start_streaming_called(&layer->buffer_queue))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (layer->layer_first_int) {
|
if (layer->layer_first_int) {
|
||||||
|
@ -314,7 +314,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
|
||||||
* if request format is yuv420 semiplanar, need to
|
* if request format is yuv420 semiplanar, need to
|
||||||
* enable both video windows
|
* enable both video windows
|
||||||
*/
|
*/
|
||||||
layer->started = 1;
|
|
||||||
layer->layer_first_int = 1;
|
layer->layer_first_int = 1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -829,11 +828,9 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
|
||||||
"VIDIOC_S_FMT, layer id = %d\n",
|
"VIDIOC_S_FMT, layer id = %d\n",
|
||||||
layer->device_id);
|
layer->device_id);
|
||||||
|
|
||||||
/* If streaming is started, return error */
|
if (vb2_is_busy(&layer->buffer_queue))
|
||||||
if (layer->started) {
|
|
||||||
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) {
|
if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) {
|
||||||
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n");
|
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -937,11 +934,9 @@ static int vpbe_display_s_std(struct file *file, void *priv,
|
||||||
|
|
||||||
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n");
|
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n");
|
||||||
|
|
||||||
/* If streaming is started, return error */
|
if (vb2_is_busy(&layer->buffer_queue))
|
||||||
if (layer->started) {
|
|
||||||
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
if (NULL != vpbe_dev->ops.s_std) {
|
if (NULL != vpbe_dev->ops.s_std) {
|
||||||
ret = vpbe_dev->ops.s_std(vpbe_dev, std_id);
|
ret = vpbe_dev->ops.s_std(vpbe_dev, std_id);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -1021,11 +1016,10 @@ static int vpbe_display_s_output(struct file *file, void *priv,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n");
|
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n");
|
||||||
/* If streaming is started, return error */
|
|
||||||
if (layer->started) {
|
if (vb2_is_busy(&layer->buffer_queue))
|
||||||
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
if (NULL == vpbe_dev->ops.set_output)
|
if (NULL == vpbe_dev->ops.set_output)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -1102,12 +1096,8 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
|
||||||
|
|
||||||
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
|
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
|
||||||
|
|
||||||
|
if (vb2_is_busy(&layer->buffer_queue))
|
||||||
/* If streaming is started, return error */
|
|
||||||
if (layer->started) {
|
|
||||||
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the given standard in the encoder */
|
/* Set the given standard in the encoder */
|
||||||
if (!vpbe_dev->ops.s_dv_timings)
|
if (!vpbe_dev->ops.s_dv_timings)
|
||||||
|
@ -1212,13 +1202,9 @@ static int vpbe_display_release(struct file *file)
|
||||||
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n");
|
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n");
|
||||||
|
|
||||||
mutex_lock(&layer->opslock);
|
mutex_lock(&layer->opslock);
|
||||||
/* Reset io_usrs member of layer object */
|
|
||||||
layer->io_usrs = 0;
|
|
||||||
|
|
||||||
osd_device->ops.disable_layer(osd_device,
|
osd_device->ops.disable_layer(osd_device,
|
||||||
layer->layer_info.id);
|
layer->layer_info.id);
|
||||||
layer->started = 0;
|
|
||||||
|
|
||||||
/* Decrement layer usrs counter */
|
/* Decrement layer usrs counter */
|
||||||
layer->usrs--;
|
layer->usrs--;
|
||||||
/* If this file handle has initialize encoder device, reset it */
|
/* If this file handle has initialize encoder device, reset it */
|
||||||
|
|
|
@ -106,12 +106,8 @@ struct vpbe_layer {
|
||||||
unsigned char window_enable;
|
unsigned char window_enable;
|
||||||
/* number of open instances of the layer */
|
/* number of open instances of the layer */
|
||||||
unsigned int usrs;
|
unsigned int usrs;
|
||||||
/* number of users performing IO */
|
|
||||||
unsigned int io_usrs;
|
|
||||||
/* Indicates id of the field which is being displayed */
|
/* Indicates id of the field which is being displayed */
|
||||||
unsigned int field_id;
|
unsigned int field_id;
|
||||||
/* Indicates whether streaming started */
|
|
||||||
unsigned char started;
|
|
||||||
/* Identifies device object */
|
/* Identifies device object */
|
||||||
enum vpbe_display_device_id device_id;
|
enum vpbe_display_device_id device_id;
|
||||||
/* facilitation of ioctl ops lock by v4l2*/
|
/* facilitation of ioctl ops lock by v4l2*/
|
||||||
|
|
Loading…
Reference in a new issue