Skip to contentSkip to conversation

davinci vpif_capture

DISCUSSION NAK Darryl 2 participants 5 messages Aug 30, 2013 – Sep 4, 2013 Media (V4L/DVB)

lore
Share & tools
lore

Darryl

author
#0 lore raw

I am working on an application involving the davinci using the vpif. My board file has the inputs configured to use VPIF_IF_RAW_BAYER if_type.
When my application starts up, I have it enumerate the formats (VIDIOC_ENUM_FMT) and it indicates that the only available format is "YCbCr4:2:2 YC Planar" (from vpif_enum_fmt_vid_cap). It looks to me that the culprit is vpif_open().

struct channel_obj.vpifparams.iface is initialized at vpif_probe() time in the function vpif_set_input. Open the device file (/dev/video0) overwrites this. I suspect that it is __not__ supposed to do this, since I don't see any method for restoring the iface.

I'm using linux-3.10.4, but the problem appears in 3.10.9, 3.11.rc7 and a version I checked out at https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git. I have supplied a patch for 3.10.9.

diff -pubwr linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c --- linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c

 2013-08-20 17:40:47.000000000 -0500
+++ linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c 
 2013-08-30 11:18:29.000000000 -0500
@@ -914,9 +914,11 @@ static int vpif_open(struct file *filep)
     fh->initialized = 0;
     /* If decoder is not initialized. initialize it */
     if (!ch->initialized) {
+        struct vpif_interface iface = ch->vpifparams.iface;
         fh->initialized = 1;
         ch->initialized = 1;
         memset(&(ch->vpifparams), 0, sizeof(struct vpif_params));
+        ch->vpifparams.iface = iface;
     }
     /* Increment channel usrs counter */
     ch->usrs++;
#1 lore raw
Quoted 7 lines · Darryl

I am working on an application involving the davinci using the vpif. My board file has the inputs configured to use VPIF_IF_RAW_BAYER if_type. When my application starts up, I have it enumerate the formats (VIDIOC_ENUM_FMT) and it indicates that the only available format is "YCbCr4:2:2 YC Planar" (from vpif_enum_fmt_vid_cap). It looks to me that the culprit is vpif_open().

Quoted 5 lines

struct channel_obj.vpifparams.iface is initialized at vpif_probe() time in the function vpif_set_input. Open the device file (/dev/video0) overwrites this. I suspect that it is __not__ supposed to do this, since I don't see any method for restoring the iface.

NAK, Ideally the application should go in the following manner, you open the device say example /dev/video0 , then you issue a VIDIOC_ENUMINPUT IOCTL, this will enumerate the inputs then you do VIDIOC_S_INPUT this will select the input device so when this IOCTL is called vpif_s_input() is called in vpif_capture driver this function will internally call the vpif_set_input() which will set the iface for you on line 1327.

In the probe it calls vpif_set_input() to select input 0 as a default device.

Hope this clears your doubt.

Regards,
--Prabhakar Lad

Quoted 33 lines

I'm using linux-3.10.4, but the problem appears in 3.10.9, 3.11.rc7 and a version I checked out at
https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git. I have supplied a patch for 3.10.9.

diff -pubwr linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c --- linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c

2013-08-20 17:40:47.000000000 -0500

+++ linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c 2013-08-30 11:18:29.000000000 -0500

(quoted diff) +2 -0
@@ -914,9 +914,11 @@ static int vpif_open(struct file *filep)
     fh->initialized = 0;
     /* If decoder is not initialized. initialize it */
     if (!ch->initialized) {
+        struct vpif_interface iface = ch->vpifparams.iface;
         fh->initialized = 1;
         ch->initialized = 1;
         memset(&(ch->vpifparams), 0, sizeof(struct vpif_params));
+        ch->vpifparams.iface = iface;
     }
     /* Increment channel usrs counter */
     ch->usrs++;

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

author
#2 lore raw
Quoted 13 lines · Prabhakar Lad
Quoted 7 lines · Darryl

I am working on an application involving the davinci using the vpif. My board file has the inputs configured to use VPIF_IF_RAW_BAYER if_type. When my application starts up, I have it enumerate the formats (VIDIOC_ENUM_FMT) and it indicates that the only available format is "YCbCr4:2:2 YC Planar" (from vpif_enum_fmt_vid_cap). It looks to me that the culprit is vpif_open().

Quoted 5 lines

struct channel_obj.vpifparams.iface is initialized at vpif_probe() time in the function vpif_set_input. Open the device file (/dev/video0) overwrites this. I suspect that it is __not__ supposed to do this, since I don't see any method for restoring the iface.

Quoted 7 lines

NAK, Ideally the application should go in the following manner, you open the device say example /dev/video0 , then you issue a VIDIOC_ENUMINPUT IOCTL, this will enumerate the inputs then you do VIDIOC_S_INPUT this will select the input device so when this IOCTL is called vpif_s_input() is called in vpif_capture driver this function will internally call the vpif_set_input() which will set the iface for you on line 1327.

Is there a document or documents where I can find this "following manner"? I've read through a lot of v4l docs, but none seem to suggest an ordered sequence of ioctl calls.

Quoted 41 lines

In the probe it calls vpif_set_input() to select input 0 as a default device.

Hope this clears your doubt.

Regards,
--Prabhakar Lad

Quoted 33 lines

I'm using linux-3.10.4, but the problem appears in 3.10.9, 3.11.rc7 and a version I checked out at
https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git. I have supplied a patch for 3.10.9.

diff -pubwr linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c --- linux-3.10.9-pristine/drivers/media/platform/davinci/vpif_capture.c

2013-08-20 17:40:47.000000000 -0500

+++ linux-3.10.9/drivers/media/platform/davinci/vpif_capture.c 2013-08-30 11:18:29.000000000 -0500

(quoted diff) +2 -0
@@ -914,9 +914,11 @@ static int vpif_open(struct file *filep)
      fh->initialized = 0;
      /* If decoder is not initialized. initialize it */
      if (!ch->initialized) {
+        struct vpif_interface iface = ch->vpifparams.iface;
          fh->initialized = 1;
          ch->initialized = 1;
          memset(&(ch->vpifparams), 0, sizeof(struct vpif_params));
+        ch->vpifparams.iface = iface;
      }
      /* Increment channel usrs counter */
      ch->usrs++;

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#3 lore raw

Hi,

Quoted 28 lines · Darryl
Quoted 18 lines · Prabhakar Lad
Quoted 8 lines · Darryl

I am working on an application involving the davinci using the vpif. My board file has the inputs configured to use VPIF_IF_RAW_BAYER if_type. When my application starts up, I have it enumerate the formats (VIDIOC_ENUM_FMT) and it indicates that the only available format is "YCbCr4:2:2 YC Planar" (from vpif_enum_fmt_vid_cap). It looks to me that the culprit is vpif_open().

Quoted 8 lines

struct channel_obj.vpifparams.iface is initialized at vpif_probe() time in
the function vpif_set_input. Open the device file (/dev/video0) overwrites
this. I suspect that it is __not__ supposed to do this, since I don't see
any method for restoring the iface.

Quoted 7 lines

NAK, Ideally the application should go in the following manner, you open the device say example /dev/video0 , then you issue a VIDIOC_ENUMINPUT IOCTL, this will enumerate the inputs then you do VIDIOC_S_INPUT this will select the input device so when this IOCTL is called vpif_s_input() is called in vpif_capture driver this function will internally call the vpif_set_input() which will set the iface for you on line 1327.

Quoted 4 lines

Is there a document or documents where I can find this "following manner"? I've read through a lot of v4l docs, but none seem to suggest an ordered sequence of ioctl calls.

Yes thats the way its done! I dont have any docs but you can refer some test application yavta[1] so that you are clear and you can also go through the link [2].

[1] http://git.ideasonboard.org/yavta.git/shortlog/refs/heads/master
[2] http://www.linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html

Regards,
--Prabhakar Lad

author
#4 lore raw
Quoted 32 lines · Prabhakar Lad

Hi,

Quoted 25 lines · Darryl
Quoted 16 lines · Prabhakar Lad
Quoted 7 lines · Darryl

I am working on an application involving the davinci using the vpif. My board file has the inputs configured to use VPIF_IF_RAW_BAYER if_type. When my application starts up, I have it enumerate the formats (VIDIOC_ENUM_FMT) and it indicates that the only available format is "YCbCr4:2:2 YC Planar" (from vpif_enum_fmt_vid_cap). It looks to me that the culprit is vpif_open().

Quoted 8 lines

struct channel_obj.vpifparams.iface is initialized at vpif_probe() time in
the function vpif_set_input. Open the device file (/dev/video0) overwrites
this. I suspect that it is __not__ supposed to do this, since I don't see
any method for restoring the iface.

Quoted 7 lines

NAK, Ideally the application should go in the following manner, you open the device say example /dev/video0 , then you issue a VIDIOC_ENUMINPUT IOCTL, this will enumerate the inputs then you do VIDIOC_S_INPUT this will select the input device so when this IOCTL is called vpif_s_input() is called in vpif_capture driver this function will internally call the vpif_set_input() which will set the iface for you on line 1327.

Quoted 4 lines

Is there a document or documents where I can find this "following manner"? I've read through a lot of v4l docs, but none seem to suggest an ordered sequence of ioctl calls.

Quoted 6 lines

Yes thats the way its done! I dont have any docs but you can refer some test application yavta[1] so that you are clear and you can also go through the link [2].

[1] http://git.ideasonboard.org/yavta.git/shortlog/refs/heads/master
[2] http://www.linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html

Thanks very much for your help. I'll check out the yavta sources.

I've looked at both the legacy and current specs. They are full of information, but sadly, in my opinion, don't give a unified vision of how to use the whole.

Quoted 4 lines

Regards,
--Prabhakar Lad