All of lore.kernel.org
 help / color / mirror / Atom feed
* v4l2_mbus_framefmt and v4l2_pix_format
@ 2011-05-25  9:56 Scott Jiang
  2011-05-25 10:10 ` Hans Verkuil
  2011-05-25 10:11 ` Guennadi Liakhovetski
  0 siblings, 2 replies; 5+ messages in thread
From: Scott Jiang @ 2011-05-25  9:56 UTC (permalink / raw)
  To: laurent.pinchart, hverkuil; +Cc: g.liakhovetski, linux-media

Hi Hans and Laurent,

I got fmt info from a video data source subdev, I thought there should
be a helper function to convert these two format enums.
However, v4l2_fill_pix_format didn't do this, why? Should I do this in
bridge driver one by one?
I think these codes are common use, I prefer adding them in
v4l2_fill_pix_format.

Thanks,
Scott

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v4l2_mbus_framefmt and v4l2_pix_format
  2011-05-25  9:56 v4l2_mbus_framefmt and v4l2_pix_format Scott Jiang
@ 2011-05-25 10:10 ` Hans Verkuil
  2011-05-25 10:11 ` Guennadi Liakhovetski
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2011-05-25 10:10 UTC (permalink / raw)
  To: Scott Jiang; +Cc: laurent.pinchart, g.liakhovetski, linux-media

On Wednesday, May 25, 2011 11:56:23 Scott Jiang wrote:
> Hi Hans and Laurent,
> 
> I got fmt info from a video data source subdev, I thought there should
> be a helper function to convert these two format enums.
> However, v4l2_fill_pix_format didn't do this, why? Should I do this in
> bridge driver one by one?
> I think these codes are common use, I prefer adding them in
> v4l2_fill_pix_format.

Only the bridge driver knows how these two enums relate. The mediabus enum
as used by subdevs describes the format of the video data as is transferred
over the physical bus between the subdev and the bridge. The V4L2_PIX_FMT*
formats describe what the video data looks like in memory. Depending on the
DMA engine those may or may not have a simple one on one mapping.

In other words, it is indeed the bridge driver that has to do the mapping.

That said, soc_camera has such a mapping. If it turns out that it can be
reused elsewhere for certain bridges, then that code should probably be
made a generic helper function. (See soc_mediabus.c/h)

Regards,

	Hans

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v4l2_mbus_framefmt and v4l2_pix_format
  2011-05-25  9:56 v4l2_mbus_framefmt and v4l2_pix_format Scott Jiang
  2011-05-25 10:10 ` Hans Verkuil
@ 2011-05-25 10:11 ` Guennadi Liakhovetski
  2011-05-25 11:49   ` Sylwester Nawrocki
  1 sibling, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2011-05-25 10:11 UTC (permalink / raw)
  To: Scott Jiang; +Cc: laurent.pinchart, hverkuil, linux-media

Hi Scott

On Wed, 25 May 2011, Scott Jiang wrote:

> Hi Hans and Laurent,
> 
> I got fmt info from a video data source subdev, I thought there should
> be a helper function to convert these two format enums.
> However, v4l2_fill_pix_format didn't do this, why? Should I do this in
> bridge driver one by one?

Because various camera hosts (bridges) can produce different pixel formats 
in memory from the same mediabus code. However, there is a very common way 
to handle such video data in the bridge: store it in RAM in a "natural" 
way. This mode is called in soc-camera the pass-through mode and there is 
an API to handle this mode in drivers/media/video/soc_mediabus.c. If this 
functionality is considered useful also outside of soc-camera, that API 
can easily be made generic.

> I think these codes are common use, I prefer adding them in
> v4l2_fill_pix_format.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v4l2_mbus_framefmt and v4l2_pix_format
  2011-05-25 10:11 ` Guennadi Liakhovetski
@ 2011-05-25 11:49   ` Sylwester Nawrocki
  2011-05-25 12:11     ` Guennadi Liakhovetski
  0 siblings, 1 reply; 5+ messages in thread
From: Sylwester Nawrocki @ 2011-05-25 11:49 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Scott Jiang, laurent.pinchart, hverkuil, linux-media

Hi Guennadi,

On 05/25/2011 12:11 PM, Guennadi Liakhovetski wrote:
> Hi Scott
> 
> On Wed, 25 May 2011, Scott Jiang wrote:
> 
>> Hi Hans and Laurent,
>>
>> I got fmt info from a video data source subdev, I thought there should
>> be a helper function to convert these two format enums.
>> However, v4l2_fill_pix_format didn't do this, why? Should I do this in
>> bridge driver one by one?
> 
> Because various camera hosts (bridges) can produce different pixel formats 
> in memory from the same mediabus code. However, there is a very common way 
> to handle such video data in the bridge: store it in RAM in a "natural" 
> way. This mode is called in soc-camera the pass-through mode and there is 
> an API to handle this mode in drivers/media/video/soc_mediabus.c. If this 

Sorry about getting off the topic a bit.

As some media bus formats require different conversion process in the bridge
to obtain specific format in memory (fourcc) I was wondering whether it would
be reasonable to indicate the "natural" fourccs for the applications when
enumerating formats supported by the bridge/DMA with VIDIOC_ENUM_FMT?
So applications are aware what are the "natural" formats and which require
lossy conversion. And in this way could choose formats that yield better
quality. 

Now there are following flags available for struct v4l2_fmtdesc::flags

V4L2_FMT_FLAG_COMPRESSED
V4L2_FMT_FLAG_EMULATED

I thought about something like V4L2_FMT_HW_EMULATED or V4L2_FMT_FLAG_LOW_QUALITY.

I not happy with those exact names but I hope that gives a basic idea what
I am talking about.  
Possibly I am missing other ways to achieve the same.

Regards,
-- 
Sylwester Nawrocki
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v4l2_mbus_framefmt and v4l2_pix_format
  2011-05-25 11:49   ` Sylwester Nawrocki
@ 2011-05-25 12:11     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2011-05-25 12:11 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: Scott Jiang, laurent.pinchart, hverkuil, linux-media

On Wed, 25 May 2011, Sylwester Nawrocki wrote:

> Hi Guennadi,
> 
> On 05/25/2011 12:11 PM, Guennadi Liakhovetski wrote:
> > Hi Scott
> > 
> > On Wed, 25 May 2011, Scott Jiang wrote:
> > 
> >> Hi Hans and Laurent,
> >>
> >> I got fmt info from a video data source subdev, I thought there should
> >> be a helper function to convert these two format enums.
> >> However, v4l2_fill_pix_format didn't do this, why? Should I do this in
> >> bridge driver one by one?
> > 
> > Because various camera hosts (bridges) can produce different pixel formats 
> > in memory from the same mediabus code. However, there is a very common way 
> > to handle such video data in the bridge: store it in RAM in a "natural" 
> > way. This mode is called in soc-camera the pass-through mode and there is 
> > an API to handle this mode in drivers/media/video/soc_mediabus.c. If this 
> 
> Sorry about getting off the topic a bit.
> 
> As some media bus formats require different conversion process in the bridge
> to obtain specific format in memory (fourcc) I was wondering whether it would
> be reasonable to indicate the "natural" fourccs for the applications when
> enumerating formats supported by the bridge/DMA with VIDIOC_ENUM_FMT?
> So applications are aware what are the "natural" formats and which require
> lossy conversion. And in this way could choose formats that yield better
> quality. 

Yes, in principle this seems like a good idea to me. Of course, somebody 
will have to teach the user-space to use this information:)

> Now there are following flags available for struct v4l2_fmtdesc::flags
> 
> V4L2_FMT_FLAG_COMPRESSED
> V4L2_FMT_FLAG_EMULATED
> 
> I thought about something like V4L2_FMT_HW_EMULATED or V4L2_FMT_FLAG_LOW_QUALITY.
> 
> I not happy with those exact names but I hope that gives a basic idea what
> I am talking about.  
> Possibly I am missing other ways to achieve the same.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-25 12:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25  9:56 v4l2_mbus_framefmt and v4l2_pix_format Scott Jiang
2011-05-25 10:10 ` Hans Verkuil
2011-05-25 10:11 ` Guennadi Liakhovetski
2011-05-25 11:49   ` Sylwester Nawrocki
2011-05-25 12:11     ` Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.