Re: [RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-18 Thread Sylwester Nawrocki
Hi Laurent,

On 02/18/2012 02:43 AM, Laurent Pinchart wrote:
> On Saturday 18 February 2012 00:33:23 Sylwester Nawrocki wrote:
>> On 02/18/2012 12:23 AM, Laurent Pinchart wrote:
 config); @@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {

 struct v4l2_mbus_config *cfg);

int (*s_mbus_config)(struct v4l2_subdev *sd,

 const struct v4l2_mbus_config *cfg);

 +  int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
 + void **buf);

};
>>>
>>> How is the embedded data transferred from the sensor to the host in your
>>> case ? Over I2C ?
>>
>> It's transferred over MIPI-CSI2 bus and is intercepted by the MIPI-CSI2
>> receiver, before the image data DMA. The MIPI-CSI2 doesn't have its own
>> DMA engine. More details can be found in patch 6/6.
> 
> As the data is transmitted by the device without any polling from the host,
> shouldn't it just go to a metadata plane in the V4L2 buffer ?

That would be more correct and more optimal from performance perspective.
However I was a bit concerned about synchronization between two interrupt
handlers and over complicating subdev-host interface.

On the other hand even now I do rely on proper interrupts' sequence and
it shouldn't be difficult to make the subdev write directly to the metadata
plane.

As far as the timing is concerned, in my case it was taking about 300 us 
to copy metadata from the MIPI-CSI receiver IO memory to the subdev's 
internal buffer and about 5 us to copy it again from that buffer to V4L2
buffer metadata plane. So I wasn't concerned much about the additional
latency. Nevertheless the numbers may be different in other cases.

As I really don't consider exposing a video node by the MIPI-CSIS driver
I'm wondering if we need some kind of buffer operations at v4l2_subdev 
interface, that would be used only in kernel space ?

For example queue_buffer/dequeue_buffer callbacks, what do you think about
it ?

--

Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-17 Thread Sakari Ailus
Hi Laurent,

Laurent Pinchart wrote:
> On Saturday 18 February 2012 00:33:23 Sylwester Nawrocki wrote:
>> On 02/18/2012 12:23 AM, Laurent Pinchart wrote:
   struct v4l2_subdev_video_ops {
   
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32

 config); @@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {

 struct v4l2_mbus_config *cfg);

int (*s_mbus_config)(struct v4l2_subdev *sd,

 const struct v4l2_mbus_config *cfg);

 +  int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
 + void **buf);

   };
>>>
>>> How is the embedded data transferred from the sensor to the host in your
>>> case ? Over I2C ?
>>
>> It's transferred over MIPI-CSI2 bus and is intercepted by the MIPI-CSI2
>> receiver, before the image data DMA. The MIPI-CSI2 doesn't have its own
>> DMA engine. More details can be found in patch 6/6.
> 
> As the data is transmitted by the device without any polling from the host, 
> shouldn't it just go to a metadata plane in the V4L2 buffer ?

I'd say that if it can be given to the user space separately, a way
should be provided to do that. It's all about timing: software
controlled digital camera depend on that.

Some receivers are also able to put such metadata into a separate memory
area using DMA, such as the OMAP 3 ISP CCP-2 receiver.

Cheers,

-- 
Sakari Ailus
sakari.ai...@iki.fi
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-17 Thread Laurent Pinchart
Hi Sylwester,

On Saturday 18 February 2012 00:33:23 Sylwester Nawrocki wrote:
> On 02/18/2012 12:23 AM, Laurent Pinchart wrote:
> >>   struct v4l2_subdev_video_ops {
> >>   
> >>int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32
> >> 
> >> config); @@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {
> >> 
> >> struct v4l2_mbus_config *cfg);
> >>
> >>int (*s_mbus_config)(struct v4l2_subdev *sd,
> >>
> >> const struct v4l2_mbus_config *cfg);
> >> 
> >> +  int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
> >> + void **buf);
> >> 
> >>   };
> > 
> > How is the embedded data transferred from the sensor to the host in your
> > case ? Over I2C ?
> 
> It's transferred over MIPI-CSI2 bus and is intercepted by the MIPI-CSI2
> receiver, before the image data DMA. The MIPI-CSI2 doesn't have its own
> DMA engine. More details can be found in patch 6/6.

As the data is transmitted by the device without any polling from the host, 
shouldn't it just go to a metadata plane in the V4L2 buffer ?

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-17 Thread Sylwester Nawrocki

Hi Laurent,

On 02/18/2012 12:23 AM, Laurent Pinchart wrote:

  struct v4l2_subdev_video_ops {
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32
config); @@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {
 struct v4l2_mbus_config *cfg);
int (*s_mbus_config)(struct v4l2_subdev *sd,
 const struct v4l2_mbus_config *cfg);
+   int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
+  void **buf);
  };


How is the embedded data transferred from the sensor to the host in your case
? Over I2C ?


It's transferred over MIPI-CSI2 bus and is intercepted by the MIPI-CSI2
receiver, before the image data DMA. The MIPI-CSI2 doesn't have its own
DMA engine. More details can be found in patch 6/6.

--

Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-17 Thread Laurent Pinchart
Hi Sylwester,

Thanks for the patch.

On Thursday 16 February 2012 19:23:56 Sylwester Nawrocki wrote:
> The g_embedded_data callback allows the host to retrieve frame embedded
> (meta) data from a certain subdev. This callback can be implemented by
> an image sensor or a MIPI-CSI receiver, allowing to read embedded frame
> data from a subdev or just query it for the data size.
> 
> Signed-off-by: Sylwester Nawrocki 
> Signed-off-by: Kyungmin Park 
> ---
>  include/media/v4l2-subdev.h |   10 ++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index f0f3358..be74061 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -274,6 +274,14 @@ struct v4l2_subdev_audio_ops {
> s_mbus_config: set a certain mediabus configuration. This operation is
> added for compatibility with soc-camera drivers and should not be used by
> new software.
> +
> +   g_embedded_data: retrieve the frame embedded data (frame header or
> footer). +After a full frame has been transmitted the host can query a
> subdev +  for frame meta data using this operation. Metadata size is
> returned +in @size, and the actual metadata in memory pointed by @data.
> When +@buf is NULL the subdev will return only the metadata size. The
> + subdevs can adjust @size to a lower value but must not write more
> + data than the @size's original value.
>   */
>  struct v4l2_subdev_video_ops {
>   int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32
> config); @@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {
>struct v4l2_mbus_config *cfg);
>   int (*s_mbus_config)(struct v4l2_subdev *sd,
>const struct v4l2_mbus_config *cfg);
> + int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
> +void **buf);
>  };

How is the embedded data transferred from the sensor to the host in your case 
? Over I2C ?

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH 3/6] V4L: Add g_embedded_data subdev callback

2012-02-16 Thread Sylwester Nawrocki
The g_embedded_data callback allows the host to retrieve frame embedded
(meta) data from a certain subdev. This callback can be implemented by
an image sensor or a MIPI-CSI receiver, allowing to read embedded frame
data from a subdev or just query it for the data size.

Signed-off-by: Sylwester Nawrocki 
Signed-off-by: Kyungmin Park 
---
 include/media/v4l2-subdev.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f0f3358..be74061 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -274,6 +274,14 @@ struct v4l2_subdev_audio_ops {
s_mbus_config: set a certain mediabus configuration. This operation is added
for compatibility with soc-camera drivers and should not be used by new
software.
+
+   g_embedded_data: retrieve the frame embedded data (frame header or footer).
+   After a full frame has been transmitted the host can query a subdev
+   for frame meta data using this operation. Metadata size is returned
+   in @size, and the actual metadata in memory pointed by @data. When
+   @buf is NULL the subdev will return only the metadata size. The
+   subdevs can adjust @size to a lower value but must not write more
+   data than the @size's original value.
  */
 struct v4l2_subdev_video_ops {
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 
config);
@@ -321,6 +329,8 @@ struct v4l2_subdev_video_ops {
 struct v4l2_mbus_config *cfg);
int (*s_mbus_config)(struct v4l2_subdev *sd,
 const struct v4l2_mbus_config *cfg);
+   int (*g_embedded_data)(struct v4l2_subdev *sd, unsigned int *size,
+  void **buf);
 };
 
 /*
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html