Message ID | 1358156164-11382-4-git-send-email-k.debski@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Kamil, Thanks for the patch. On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > Set proper timestamp type in drivers that I am sure that use either > MONOTONIC or COPY timestamps. Other drivers will correctly report > UNKNOWN timestamp type instead of assuming that all drivers use monotonic > timestamps. What other kind of timestamps there can be? All drivers (at least those not mem-to-mem) that do obtain timestamps using system clock use monotonic ones. I'd think that there should no longer be any drivers using the UNKNOWN timestamp type: UNKNOWN is either from monotonic or realtime clock, and we just replaced all of them with the monotonic ones. No driver uses realtime timestamps anymore. How about making MONOTONIC timestamps default instead, or at least assigning all drivers something else than UNKNOWN?
Hi, > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > Sent: Saturday, January 19, 2013 6:43 PM > Hi Kamil, > > Thanks for the patch. > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > Set proper timestamp type in drivers that I am sure that use either > > MONOTONIC or COPY timestamps. Other drivers will correctly report > > UNKNOWN timestamp type instead of assuming that all drivers use > > monotonic timestamps. > > What other kind of timestamps there can be? All drivers (at least those > not > mem-to-mem) that do obtain timestamps using system clock use monotonic > ones. Not set. It is not a COPY or MONOTONIC either. Any new or custom kind of timestamp, maybe? > I'd think that there should no longer be any drivers using the UNKNOWN > timestamp type: UNKNOWN is either from monotonic or realtime clock, and > we just replaced all of them with the monotonic ones. No driver uses > realtime timestamps anymore. Maybe there should be no drivers using UNKNOWN. But definitely there should be no driver reporting MONOTONIC when the timestamp is not monotonic. > How about making MONOTONIC timestamps default instead, or at least > assigning all drivers something else than UNKNOWN? So why did you add the UNKNOWN flag? The way I see it - UNKNOWN is the default and the one who coded the driver will set it to either MONOTONIC or COPY if it is one of these two. It won't be changed otherwise. There are drivers, which do not fill the timestamp field at all: - drivers/media/platform/coda.c - drivers/media/platform/exynos-gsc/gsc-m2m.c - drivers/media/platform/m2m-deinterlace.c - drivers/media/platform/mx2_emmaprp.c - drivers/media/platform/s5p-fimc/fimc-m2m.c - drivers/media/platform/s5p-g2d.c - drivers/media/platform/s5p-jpeg/jpeg-core.c The way you did it in your patches left no room for any kind of choice. I did comment at least twice about mem-2-mem devices in your RFCs, if I remember correctly. I think Sylwester was also writing about this. Still everything got marked as MONOTONIC. If we were to assume that there were no other timestamp types then monotonic (which is not true, but this was your assumption), then what was the reason to add this timestamp framework? Best wishes,
Hi, One more comment. Also adding videobuf2 maintainers to CC, as they were not added in the patch "v4l: Tell user space we're using monotonic timestamps". > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > Sent: Saturday, January 19, 2013 6:43 PM > > Hi Kamil, > > Thanks for the patch. > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > Set proper timestamp type in drivers that I am sure that use either > > MONOTONIC or COPY timestamps. Other drivers will correctly report > > UNKNOWN timestamp type instead of assuming that all drivers use > > monotonic timestamps. > > What other kind of timestamps there can be? All drivers (at least those > not > mem-to-mem) that do obtain timestamps using system clock use monotonic > ones. > > I'd think that there should no longer be any drivers using the UNKNOWN > timestamp type: UNKNOWN is either from monotonic or realtime clock, and > we just replaced all of them with the monotonic ones. No driver uses > realtime timestamps anymore. > > How about making MONOTONIC timestamps default instead, or at least > assigning all drivers something else than UNKNOWN? In addition to my previous comment - making MONOTONIC default in videobuf2 would be inconsistent. For non videobuf2 drivers the default is UNKNOWN, so making MONOTONIC default for videobuf2 drivers is, in my opinion, wrong. Best wishes, Kamil Debski -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kamil, (Cc'ing Pawel and Marek as well.) On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > Hi, > > > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > > Sent: Saturday, January 19, 2013 6:43 PM > > Hi Kamil, > > > > Thanks for the patch. > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > Set proper timestamp type in drivers that I am sure that use either > > > MONOTONIC or COPY timestamps. Other drivers will correctly report > > > UNKNOWN timestamp type instead of assuming that all drivers use > > > monotonic timestamps. > > > > What other kind of timestamps there can be? All drivers (at least those > > not > > mem-to-mem) that do obtain timestamps using system clock use monotonic > > ones. > > Not set. It is not a COPY or MONOTONIC either. Any new or custom kind of > timestamp, maybe? Then new timestamp types should be defined for the purpose. Which is indeed what your patch is about. And about "COPY" timestamps: if an application wants to use timestamps, it probably need to know what kind of timestamps they are. "COPY" doesn't provide that information as such. Only the program that sets the timestamps for the OUTPUT buffers does. > > I'd think that there should no longer be any drivers using the UNKNOWN > > timestamp type: UNKNOWN is either from monotonic or realtime clock, and > > we just replaced all of them with the monotonic ones. No driver uses > > realtime timestamps anymore. > > Maybe there should be no drivers using UNKNOWN. But definitely > there should be no driver reporting MONOTONIC when the timestamp is not > monotonic. > > > How about making MONOTONIC timestamps default instead, or at least > > assigning all drivers something else than UNKNOWN? > > So why did you add the UNKNOWN flag? This is for API compatibility only. Applications running on kernels prior to the headers of which define timestamp types will not have timestamp type set (i.e. is zero, which equals to UNKNOWN). There was a lengthy discussion on the topic back then, and the conclusion was that the kernel version itself isn't enough to tell what kind of timestamps are provided to the user. Any new driver shouldn't use UNKNOWN timestamps since in this case the application would have to know what kind of timestamps the driver uses --- which is why we now specify it in the API. > The way I see it - UNKNOWN is the default and the one who coded the driver > will set it to either MONOTONIC or COPY if it is one of these two. It won't > be changed otherwise. There are drivers, which do not fill the timestamp > field > at all: > - drivers/media/platform/coda.c > - drivers/media/platform/exynos-gsc/gsc-m2m.c > - drivers/media/platform/m2m-deinterlace.c > - drivers/media/platform/mx2_emmaprp.c > - drivers/media/platform/s5p-fimc/fimc-m2m.c > - drivers/media/platform/s5p-g2d.c > - drivers/media/platform/s5p-jpeg/jpeg-core.c Excellent point. But --- should these drivers then fill the timestamp field? Isn't it a bug in the driver not to do so? > The way you did it in your patches left no room for any kind of choice. I > did > comment at least twice about mem-2-mem devices in your RFCs, if I remember > correctly. I think Sylwester was also writing about this. > Still everything got marked as MONOTONIC. I must have missed this in the discussion back then. > If we were to assume that there were no other timestamp types then monotonic > (which is not true, but this was your assumption), then what was the reason > to add this timestamp framework? For capture devices whose video source has no native timestamps the timestamps are MONOTONIC, at least until it is made selectable. Other examples could include video decoders or encoders, but these timestamps will be entirely different kind, and probably doesn't end up to the timestamp field.
Hi Sakari, Thank you for your quick reply. > From: 'Sakari Ailus' [mailto:sakari.ailus@iki.fi] > Sent: Tuesday, January 22, 2013 11:03 AM > Hi Kamil, > > (Cc'ing Pawel and Marek as well.) > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > Hi, > > > > > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > > > Sent: Saturday, January 19, 2013 6:43 PM Hi Kamil, > > > > > > Thanks for the patch. > > > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > Set proper timestamp type in drivers that I am sure that use > > > > either MONOTONIC or COPY timestamps. Other drivers will correctly > > > > report UNKNOWN timestamp type instead of assuming that all > drivers > > > > use monotonic timestamps. > > > > > > What other kind of timestamps there can be? All drivers (at least > > > those not > > > mem-to-mem) that do obtain timestamps using system clock use > > > monotonic ones. > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom kind > > of timestamp, maybe? > > Then new timestamp types should be defined for the purpose. Which is > indeed what your patch is about. > > And about "COPY" timestamps: if an application wants to use timestamps, > it probably need to know what kind of timestamps they are. "COPY" > doesn't provide that information as such. Only the program that sets > the timestamps for the OUTPUT buffers does. For me the COPY type is clear. If the app gets a COPY timestamp on a buffer (CAPTURE) then it knows that it was copied from the OUTPUT buffer. If the application did not set the timestamp for OUTPUT buffer, then it has to cope with the consequences. > > > > I'd think that there should no longer be any drivers using the > > > UNKNOWN timestamp type: UNKNOWN is either from monotonic or > realtime > > > clock, and we just replaced all of them with the monotonic ones. No > > > driver uses realtime timestamps anymore. > > > > Maybe there should be no drivers using UNKNOWN. But definitely there > > should be no driver reporting MONOTONIC when the timestamp is not > > monotonic. > > > > > How about making MONOTONIC timestamps default instead, or at least > > > assigning all drivers something else than UNKNOWN? > > > > So why did you add the UNKNOWN flag? > > This is for API compatibility only. Applications running on kernels > prior to the headers of which define timestamp types will not have > timestamp type set (i.e. is zero, which equals to UNKNOWN). There was a > lengthy discussion on the topic back then, and the conclusion was that > the kernel version itself isn't enough to tell what kind of timestamps > are provided to the user. > > Any new driver shouldn't use UNKNOWN timestamps since in this case the > application would have to know what kind of timestamps the driver uses > --- which is why we now specify it in the API. > > > The way I see it - UNKNOWN is the default and the one who coded the > > driver will set it to either MONOTONIC or COPY if it is one of these > > two. It won't be changed otherwise. There are drivers, which do not > > fill the timestamp field at all: > > - drivers/media/platform/coda.c > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > - drivers/media/platform/m2m-deinterlace.c > > - drivers/media/platform/mx2_emmaprp.c > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > - drivers/media/platform/s5p-g2d.c > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > Excellent point. > > But --- should these drivers then fill the timestamp field? Isn't it a > bug in the driver not to do so? Could be. The only thing I am complaining about is that the type should not be reported as monotonic when it is not. (We can argue that constant is monotonic, but I think that it is not the point :-) ). This is why I propose to leave UNKNOWN as the default choice (which it is in case of non videobuf2 drivers). It is possible to eliminate the UNKNOWN in my opinion, but it should be up to the programmer to set the type. Another option is to eliminate the UNKNOWN flag in the next, or in two kernel releases. After the drivers are changed. Still I prefer to leave the driver's programmer in charge and leave the UNKNOWN type. > > > The way you did it in your patches left no room for any kind of > > choice. I did comment at least twice about mem-2-mem devices in your > > RFCs, if I remember correctly. I think Sylwester was also writing > > about this. > > Still everything got marked as MONOTONIC. > > I must have missed this in the discussion back then. > > > If we were to assume that there were no other timestamp types then > > monotonic (which is not true, but this was your assumption), then > what > > was the reason to add this timestamp framework? > > For capture devices whose video source has no native timestamps the > timestamps are MONOTONIC, at least until it is made selectable. Other > examples could include video decoders or encoders, but these timestamps > will be entirely different kind, and probably doesn't end up to the > timestamp field. > Thanks. Best wishes,
On Tue 22 January 2013 11:03:03 'Sakari Ailus' wrote: > Hi Kamil, > > (Cc'ing Pawel and Marek as well.) > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > Hi, > > > > > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > > > Sent: Saturday, January 19, 2013 6:43 PM > > > Hi Kamil, > > > > > > Thanks for the patch. > > > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > Set proper timestamp type in drivers that I am sure that use either > > > > MONOTONIC or COPY timestamps. Other drivers will correctly report > > > > UNKNOWN timestamp type instead of assuming that all drivers use > > > > monotonic timestamps. > > > > > > What other kind of timestamps there can be? All drivers (at least those > > > not > > > mem-to-mem) that do obtain timestamps using system clock use monotonic > > > ones. > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom kind of > > timestamp, maybe? > > Then new timestamp types should be defined for the purpose. Which is indeed > what your patch is about. > > And about "COPY" timestamps: if an application wants to use timestamps, it > probably need to know what kind of timestamps they are. "COPY" doesn't > provide that information as such. Only the program that sets the timestamps > for the OUTPUT buffers does. For these m2m devices the driver does not use the timestamp value at all, it just copies it from the output stream (i.e. towards the codec) to the input stream (i.e. from the codec). Since the application got the video from somewhere the application presumably knows the type of the timestamp. So I think marking this as COPY is a very good idea. It makes no sense to put in a specific timestamp type since the driver doesn't control that at all. Things are quite different when it is the driver that generates the timestamp, then the application needs to know what sort of timestamp the driver generated and that should be filled in correctly by the driver. > > > I'd think that there should no longer be any drivers using the UNKNOWN > > > timestamp type: UNKNOWN is either from monotonic or realtime clock, and > > > we just replaced all of them with the monotonic ones. No driver uses > > > realtime timestamps anymore. > > > > Maybe there should be no drivers using UNKNOWN. But definitely > > there should be no driver reporting MONOTONIC when the timestamp is not > > monotonic. > > > > > How about making MONOTONIC timestamps default instead, or at least > > > assigning all drivers something else than UNKNOWN? > > > > So why did you add the UNKNOWN flag? > > This is for API compatibility only. Applications running on kernels prior to > the headers of which define timestamp types will not have timestamp type set > (i.e. is zero, which equals to UNKNOWN). There was a lengthy discussion on > the topic back then, and the conclusion was that the kernel version itself > isn't enough to tell what kind of timestamps are provided to the user. > > Any new driver shouldn't use UNKNOWN timestamps since in this case the > application would have to know what kind of timestamps the driver uses --- > which is why we now specify it in the API. > > > The way I see it - UNKNOWN is the default and the one who coded the driver > > will set it to either MONOTONIC or COPY if it is one of these two. It won't > > be changed otherwise. There are drivers, which do not fill the timestamp > > field > > at all: > > - drivers/media/platform/coda.c > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > - drivers/media/platform/m2m-deinterlace.c > > - drivers/media/platform/mx2_emmaprp.c > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > - drivers/media/platform/s5p-g2d.c > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > Excellent point. > > But --- should these drivers then fill the timestamp field? Isn't it a bug > in the driver not to do so? Not for mem2mem devices. You give it a frame with an associate timestamp which is copied to the (de)coded frame. The timestamps here indicate when the original frame was generated, which is information you want to keep. Note that the COPY timestamp assumes that there is a 1-to-1 mapping between an input frame and an output frame. If that's no longer the case (e.g. if a sequence of discrete frames is encoded as an MPEG bitstream), then drivers should just generate MONOTONIC timestamps. Unlikely to be very useful, but if nothing else it might be used for some performance measurements. > > The way you did it in your patches left no room for any kind of choice. I > > did > > comment at least twice about mem-2-mem devices in your RFCs, if I remember > > correctly. I think Sylwester was also writing about this. > > Still everything got marked as MONOTONIC. > > I must have missed this in the discussion back then. > > > If we were to assume that there were no other timestamp types then monotonic > > (which is not true, but this was your assumption), then what was the reason > > to add this timestamp framework? > > For capture devices whose video source has no native timestamps the > timestamps are MONOTONIC, at least until it is made selectable. Other > examples could include video decoders or encoders, but these timestamps will > be entirely different kind, and probably doesn't end up to the timestamp > field. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, On 01/21/2013 03:07 PM, Kamil Debski wrote: >> How about making MONOTONIC timestamps default instead, or at least >> assigning all drivers something else than UNKNOWN? > > So why did you add the UNKNOWN flag? > > The way I see it - UNKNOWN is the default and the one who coded the driver > will set it to either MONOTONIC or COPY if it is one of these two. It won't > be changed otherwise. There are drivers, which do not fill the timestamp > field > at all: > - drivers/media/platform/coda.c > - drivers/media/platform/exynos-gsc/gsc-m2m.c Hmm, there is already a patch queued for this driver. It was intended for v3.8 but has been delayed to 3.9. http://git.linuxtv.org/media_tree.git/commitdiff/f60e160e126bdd8f0d928cd8b3fce54659597394 > - drivers/media/platform/m2m-deinterlace.c > - drivers/media/platform/mx2_emmaprp.c > - drivers/media/platform/s5p-fimc/fimc-m2m.c > - drivers/media/platform/s5p-g2d.c > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > The way you did it in your patches left no room for any kind of choice. I > did > comment at least twice about mem-2-mem devices in your RFCs, if I remember > correctly. I think Sylwester was also writing about this. > Still everything got marked as MONOTONIC. > > If we were to assume that there were no other timestamp types then monotonic > (which is not true, but this was your assumption), then what was the reason > to add this timestamp framework? Hmm, we could likely leave MONOTONIC as the default timestamp type. It doesn't really matter what is the default, as long as drivers are provided with an API to override it. The reason why the above drivers don't do anything with v4l2_buffer::timestamp field is there is no clear definitions at the specification for mem-to-mem devices. We are working here on a Video Memory-to-memory Interface DocBook documentation. I think we will need a way to tell user space that timestamps are copied from OUTPUT to CAPTURE buffer queue. At least that's what seems more useful for applications. i.e. copying timestamps, rather than filling them with the monotonic clock value. OTOH I'm not certain what's the main purpose of such copied timestamps, is it to identify which CAPTURE buffer comes from which OUTPUT buffer ? -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Hans, Thank you for your comments. > From: Hans Verkuil [mailto:hansverk@cisco.com] > Sent: Tuesday, January 22, 2013 11:35 AM > > On Tue 22 January 2013 11:03:03 'Sakari Ailus' wrote: > > Hi Kamil, > > > > (Cc'ing Pawel and Marek as well.) > > > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > > Hi, > > > > > > > From: Sakari Ailus [mailto:sakari.ailus@iki.fi] > > > > Sent: Saturday, January 19, 2013 6:43 PM Hi Kamil, > > > > > > > > Thanks for the patch. > > > > > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > > Set proper timestamp type in drivers that I am sure that use > > > > > either MONOTONIC or COPY timestamps. Other drivers will > > > > > correctly report UNKNOWN timestamp type instead of assuming > that > > > > > all drivers use monotonic timestamps. > > > > > > > > What other kind of timestamps there can be? All drivers (at least > > > > those not > > > > mem-to-mem) that do obtain timestamps using system clock use > > > > monotonic ones. > > > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom > > > kind of timestamp, maybe? > > > > Then new timestamp types should be defined for the purpose. Which is > > indeed what your patch is about. > > > > And about "COPY" timestamps: if an application wants to use > > timestamps, it probably need to know what kind of timestamps they are. > > "COPY" doesn't provide that information as such. Only the program > that > > sets the timestamps for the OUTPUT buffers does. > > For these m2m devices the driver does not use the timestamp value at > all, it just copies it from the output stream (i.e. towards the codec) > to the input stream (i.e. from the codec). Since the application got > the video from somewhere the application presumably knows the type of > the timestamp. > > So I think marking this as COPY is a very good idea. It makes no sense > to put in a specific timestamp type since the driver doesn't control > that at all. > > Things are quite different when it is the driver that generates the > timestamp, then the application needs to know what sort of timestamp > the driver generated and that should be filled in correctly by the > driver. > > > > > I'd think that there should no longer be any drivers using the > > > > UNKNOWN timestamp type: UNKNOWN is either from monotonic or > > > > realtime clock, and we just replaced all of them with the > > > > monotonic ones. No driver uses realtime timestamps anymore. > > > > > > Maybe there should be no drivers using UNKNOWN. But definitely > there > > > should be no driver reporting MONOTONIC when the timestamp is not > > > monotonic. > > > > > > > How about making MONOTONIC timestamps default instead, or at > least > > > > assigning all drivers something else than UNKNOWN? > > > > > > So why did you add the UNKNOWN flag? > > > > This is for API compatibility only. Applications running on kernels > > prior to the headers of which define timestamp types will not have > > timestamp type set (i.e. is zero, which equals to UNKNOWN). There was > > a lengthy discussion on the topic back then, and the conclusion was > > that the kernel version itself isn't enough to tell what kind of > timestamps are provided to the user. > > > > Any new driver shouldn't use UNKNOWN timestamps since in this case > the > > application would have to know what kind of timestamps the driver > uses > > --- which is why we now specify it in the API. > > > > > The way I see it - UNKNOWN is the default and the one who coded the > > > driver will set it to either MONOTONIC or COPY if it is one of > these > > > two. It won't be changed otherwise. There are drivers, which do not > > > fill the timestamp field at all: > > > - drivers/media/platform/coda.c > > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > > - drivers/media/platform/m2m-deinterlace.c > > > - drivers/media/platform/mx2_emmaprp.c > > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > > - drivers/media/platform/s5p-g2d.c > > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > > > Excellent point. > > > > But --- should these drivers then fill the timestamp field? Isn't it > a > > bug in the driver not to do so? > > Not for mem2mem devices. You give it a frame with an associate > timestamp which is copied to the (de)coded frame. The timestamps here > indicate when the original frame was generated, which is information > you want to keep. > > Note that the COPY timestamp assumes that there is a 1-to-1 mapping > between an input frame and an output frame. If that's no longer the > case (e.g. if a sequence of discrete frames is encoded as an MPEG > bitstream), then drivers should just generate MONOTONIC timestamps. > Unlikely to be very useful, but if nothing else it might be used for > some performance measurements. In case the relationship is not 1-1 it gets quite complicated, but the copy method can be still used. In that case if N CAPTURE buffers are produced from one OUTPUT buffer then all of them have the same timestamp. They can be distinguished by the sequence number. In the opposite case - when N OUTPUT buffers create one CAPTURE buffer it will have the timestamp of the last OUTPUT buffer processed. > > > > The way you did it in your patches left no room for any kind of > > > choice. I did comment at least twice about mem-2-mem devices in > your > > > RFCs, if I remember correctly. I think Sylwester was also writing > > > about this. > > > Still everything got marked as MONOTONIC. > > > > I must have missed this in the discussion back then. > > > > > If we were to assume that there were no other timestamp types then > > > monotonic (which is not true, but this was your assumption), then > > > what was the reason to add this timestamp framework? > > [snip] Best wishes,
Hi, > From: Sylwester Nawrocki [mailto:s.nawrocki@samsung.com] > Sent: Tuesday, January 22, 2013 11:38 AM > > Hi, > > On 01/21/2013 03:07 PM, Kamil Debski wrote: > >> How about making MONOTONIC timestamps default instead, or at least > >> assigning all drivers something else than UNKNOWN? > > > > So why did you add the UNKNOWN flag? > > > > The way I see it - UNKNOWN is the default and the one who coded the > > driver will set it to either MONOTONIC or COPY if it is one of these > > two. It won't be changed otherwise. There are drivers, which do not > > fill the timestamp field at all: > > - drivers/media/platform/coda.c > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > Hmm, there is already a patch queued for this driver. It was intended > for v3.8 but has been delayed to 3.9. > > http://git.linuxtv.org/media_tree.git/commitdiff/f60e160e126bdd8f0d928c > d8b3fce54659597394 > > > - drivers/media/platform/m2m-deinterlace.c > > - drivers/media/platform/mx2_emmaprp.c > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > - drivers/media/platform/s5p-g2d.c > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > > > The way you did it in your patches left no room for any kind of > > choice. I did comment at least twice about mem-2-mem devices in your > > RFCs, if I remember correctly. I think Sylwester was also writing > > about this. > > Still everything got marked as MONOTONIC. > > > > If we were to assume that there were no other timestamp types then > > monotonic (which is not true, but this was your assumption), then > what > > was the reason to add this timestamp framework? > > Hmm, we could likely leave MONOTONIC as the default timestamp type. It > doesn't really matter what is the default, as long as drivers are > provided with an API to override it. > > The reason why the above drivers don't do anything with > v4l2_buffer::timestamp field is there is no clear definitions at the > specification for mem-to-mem devices. We are working here on a Video > Memory-to-memory Interface DocBook documentation. > > I think we will need a way to tell user space that timestamps are > copied from OUTPUT to CAPTURE buffer queue. At least that's what seems > more useful for applications. i.e. copying timestamps, rather than > filling them with the monotonic clock value. > > OTOH I'm not certain what's the main purpose of such copied timestamps, > is it to identify which CAPTURE buffer comes from which OUTPUT buffer ? > Yes, indeed. This is especially useful when the CAPTURE buffers can be returned in an order different than the order of corresponding OUTPUT buffers. Best wishes,
Hi Kamil, On Tue, Jan 22, 2013 at 06:58:09PM +0100, Kamil Debski wrote: ... > > OTOH I'm not certain what's the main purpose of such copied timestamps, > > is it to identify which CAPTURE buffer comes from which OUTPUT buffer ? > > > > Yes, indeed. This is especially useful when the CAPTURE buffers can be > returned in an order different than the order of corresponding OUTPUT > buffers. How about sequence numbers then? Shouldn't that be also copied? If you're interested in the order alone, comparing the sequence numbers is a better way to figure out the order. That does require strict one-to-one mapping between the output and capture buffers, though, and that does not help in knowing when it might be a good time to display a frame, for instance.
Hi Kamil, On Tuesday 22 January 2013 11:24:09 Kamil Debski wrote: > On Tuesday, January 22, 2013 11:03 AM Sakari Ailus wrote: > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > > On Saturday, January 19, 2013 6:43 PM Sakari Ailus wrote: > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > > Set proper timestamp type in drivers that I am sure that use > > > > > either MONOTONIC or COPY timestamps. Other drivers will correctly > > > > > report UNKNOWN timestamp type instead of assuming that all > > > > > drivers use monotonic timestamps. > > > > > > > > What other kind of timestamps there can be? All drivers (at least > > > > those not mem-to-mem) that do obtain timestamps using system clock use > > > > monotonic ones. > > > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom kind > > > of timestamp, maybe? > > > > Then new timestamp types should be defined for the purpose. Which is > > indeed what your patch is about. > > > > And about "COPY" timestamps: if an application wants to use timestamps, > > it probably need to know what kind of timestamps they are. "COPY" > > doesn't provide that information as such. Only the program that sets > > the timestamps for the OUTPUT buffers does. > > For me the COPY type is clear. If the app gets a COPY timestamp on a > buffer (CAPTURE) then it knows that it was copied from the OUTPUT buffer. > If the application did not set the timestamp for OUTPUT buffer, then > it has to cope with the consequences. > > > > > I'd think that there should no longer be any drivers using the > > > > UNKNOWN timestamp type: UNKNOWN is either from monotonic or realtime > > > > clock, and we just replaced all of them with the monotonic ones. No > > > > driver uses realtime timestamps anymore. > > > > > > Maybe there should be no drivers using UNKNOWN. But definitely there > > > should be no driver reporting MONOTONIC when the timestamp is not > > > monotonic. > > > > > > > How about making MONOTONIC timestamps default instead, or at least > > > > assigning all drivers something else than UNKNOWN? > > > > > > So why did you add the UNKNOWN flag? > > > > This is for API compatibility only. Applications running on kernels > > prior to the headers of which define timestamp types will not have > > timestamp type set (i.e. is zero, which equals to UNKNOWN). There was a > > lengthy discussion on the topic back then, and the conclusion was that > > the kernel version itself isn't enough to tell what kind of timestamps > > are provided to the user. > > > > Any new driver shouldn't use UNKNOWN timestamps since in this case the > > application would have to know what kind of timestamps the driver uses > > --- which is why we now specify it in the API. > > > > > The way I see it - UNKNOWN is the default and the one who coded the > > > driver will set it to either MONOTONIC or COPY if it is one of these > > > two. It won't be changed otherwise. There are drivers, which do not > > > fill the timestamp field at all: > > > - drivers/media/platform/coda.c > > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > > - drivers/media/platform/m2m-deinterlace.c > > > - drivers/media/platform/mx2_emmaprp.c > > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > > - drivers/media/platform/s5p-g2d.c > > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > > > Excellent point. > > > > But --- should these drivers then fill the timestamp field? Isn't it a > > bug in the driver not to do so? > > Could be. The only thing I am complaining about is that the type should not > be reported as monotonic when it is not. Of course. > (We can argue that constant is monotonic, but I think that it is not the > point :-) ). This is why I propose to leave UNKNOWN as the default choice > (which it is in case of non videobuf2 drivers). It is possible to eliminate > the UNKNOWN in my opinion, but it should be up to the programmer to set the > type. Another option is to eliminate the UNKNOWN flag in the next, or in two > kernel releases. After the drivers are changed. Still I prefer to leave the > driver's programmer in charge and leave the UNKNOWN type. I think that Sakari's point is that all non mem-to-mem drivers should use the MONOTONIC timestamps type. UNKNOWN, in the non mem-to-mem case, is only meant for compatibility with older kernels. We should thus default to MONOTONIC and let drivers select a different timestamp type when needed (for mem-to-mem drivers for instance). > > > The way you did it in your patches left no room for any kind of > > > choice. I did comment at least twice about mem-2-mem devices in your > > > RFCs, if I remember correctly. I think Sylwester was also writing > > > about this. Still everything got marked as MONOTONIC. > > > > I must have missed this in the discussion back then. > > > > > If we were to assume that there were no other timestamp types then > > > monotonic (which is not true, but this was your assumption), then > > > what was the reason to add this timestamp framework? > > > > For capture devices whose video source has no native timestamps the > > timestamps are MONOTONIC, at least until it is made selectable. Other > > examples could include video decoders or encoders, but these timestamps > > will be entirely different kind, and probably doesn't end up to the > > timestamp field.
Hi, > From: Laurent Pinchart [mailto:laurent.pinchart@ideasonboard.com] > Sent: Wednesday, January 23, 2013 1:26 AM > > Hi Kamil, > > On Tuesday 22 January 2013 11:24:09 Kamil Debski wrote: > > On Tuesday, January 22, 2013 11:03 AM Sakari Ailus wrote: > > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > > > On Saturday, January 19, 2013 6:43 PM Sakari Ailus wrote: > > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > > > Set proper timestamp type in drivers that I am sure that use > > > > > > either MONOTONIC or COPY timestamps. Other drivers will > > > > > > correctly report UNKNOWN timestamp type instead of assuming > > > > > > that all drivers use monotonic timestamps. > > > > > > > > > > What other kind of timestamps there can be? All drivers (at > > > > > least those not mem-to-mem) that do obtain timestamps using > > > > > system clock use monotonic ones. > > > > > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom > > > > kind of timestamp, maybe? > > > > > > Then new timestamp types should be defined for the purpose. Which > is > > > indeed what your patch is about. > > > > > > And about "COPY" timestamps: if an application wants to use > > > timestamps, it probably need to know what kind of timestamps they > are. "COPY" > > > doesn't provide that information as such. Only the program that > sets > > > the timestamps for the OUTPUT buffers does. > > > > For me the COPY type is clear. If the app gets a COPY timestamp on a > > buffer (CAPTURE) then it knows that it was copied from the OUTPUT > buffer. > > If the application did not set the timestamp for OUTPUT buffer, then > > it has to cope with the consequences. > > > > > > > I'd think that there should no longer be any drivers using the > > > > > UNKNOWN timestamp type: UNKNOWN is either from monotonic or > > > > > realtime clock, and we just replaced all of them with the > > > > > monotonic ones. No driver uses realtime timestamps anymore. > > > > > > > > Maybe there should be no drivers using UNKNOWN. But definitely > > > > there should be no driver reporting MONOTONIC when the timestamp > > > > is not monotonic. > > > > > > > > > How about making MONOTONIC timestamps default instead, or at > > > > > least assigning all drivers something else than UNKNOWN? > > > > > > > > So why did you add the UNKNOWN flag? > > > > > > This is for API compatibility only. Applications running on kernels > > > prior to the headers of which define timestamp types will not have > > > timestamp type set (i.e. is zero, which equals to UNKNOWN). There > > > was a lengthy discussion on the topic back then, and the conclusion > > > was that the kernel version itself isn't enough to tell what kind > of > > > timestamps are provided to the user. > > > > > > Any new driver shouldn't use UNKNOWN timestamps since in this case > > > the application would have to know what kind of timestamps the > > > driver uses > > > --- which is why we now specify it in the API. > > > > > > > The way I see it - UNKNOWN is the default and the one who coded > > > > the driver will set it to either MONOTONIC or COPY if it is one > of > > > > these two. It won't be changed otherwise. There are drivers, > which > > > > do not fill the timestamp field at all: > > > > - drivers/media/platform/coda.c > > > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > > > - drivers/media/platform/m2m-deinterlace.c > > > > - drivers/media/platform/mx2_emmaprp.c > > > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > > > - drivers/media/platform/s5p-g2d.c > > > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > > > > > Excellent point. > > > > > > But --- should these drivers then fill the timestamp field? Isn't > it > > > a bug in the driver not to do so? > > > > Could be. The only thing I am complaining about is that the type > > should not be reported as monotonic when it is not. > > Of course. > > > (We can argue that constant is monotonic, but I think that it is not > > the point :-) ). This is why I propose to leave UNKNOWN as the > default > > choice (which it is in case of non videobuf2 drivers). It is possible > > to eliminate the UNKNOWN in my opinion, but it should be up to the > > programmer to set the type. Another option is to eliminate the > UNKNOWN > > flag in the next, or in two kernel releases. After the drivers are > > changed. Still I prefer to leave the driver's programmer in charge > and leave the UNKNOWN type. > > I think that Sakari's point is that all non mem-to-mem drivers should > use the MONOTONIC timestamps type. Good point. I didn't say they should not. It's all ok with me. > UNKNOWN, in the non mem-to-mem case, > is only meant for compatibility with older kernels. We should thus > default to MONOTONIC and let drivers select a different timestamp type > when needed (for mem-to-mem drivers for instance). I can agree with that if the MONOTONIC is a real default. Not videobuf2 exclusive default. In case of non vb2 drivers the default (driver does not set the timestamp type flag at all) is UNKNOWN. I would expect that if no action on the programmer side is taken then videobuf2 and non videobuf2 drivers would act in a similar way. Laurent, I really think that it may confuse someone. I think the MONOTONIC timestamp type should indicate a driver that supplies a monotonic timestamp. Not a newer kernel that sets it as default (and it does only in case of vb2 drivers, not others). > > > > > The way you did it in your patches left no room for any kind of > > > > choice. I did comment at least twice about mem-2-mem devices in > > > > your RFCs, if I remember correctly. I think Sylwester was also > > > > writing about this. Still everything got marked as MONOTONIC. > > > > > > I must have missed this in the discussion back then. > > > > > > > If we were to assume that there were no other timestamp types > then > > > > monotonic (which is not true, but this was your assumption), then > > > > what was the reason to add this timestamp framework? > > > > > > For capture devices whose video source has no native timestamps the > > > timestamps are MONOTONIC, at least until it is made selectable. > > > Other examples could include video decoders or encoders, but these > > > timestamps will be entirely different kind, and probably doesn't > end > > > up to the timestamp field. > > -- > Regards, > > Laurent Pinchart Best wishes,
Hi, > From: 'Sakari Ailus' [mailto:sakari.ailus@iki.fi] > Sent: Tuesday, January 22, 2013 7:45 PM > > Hi Kamil, > > On Tue, Jan 22, 2013 at 06:58:09PM +0100, Kamil Debski wrote: > ... > > > OTOH I'm not certain what's the main purpose of such copied > > > timestamps, is it to identify which CAPTURE buffer comes from which > OUTPUT buffer ? > > > > > > > Yes, indeed. This is especially useful when the CAPTURE buffers can > be > > returned in an order different than the order of corresponding OUTPUT > > buffers. > > How about sequence numbers then? Shouldn't that be also copied? > > If you're interested in the order alone, comparing the sequence numbers > is a better way to figure out the order. That does require strict one- > to-one mapping between the output and capture buffers, though, and that > does not help in knowing when it might be a good time to display a > frame, for instance. > The idea behind copying the timestamp was that it can propagate the timestamp from the video stream. If this info is absent application can generate them and still be able to connect OUTPUT and CAPTURE frames. While decoding MPEG4 it is possible to get a compressed frame saying "nothing to do here, move along" (which basically means that the last frame should be repeated). This is where increasing sequence number comes in handy. Even if no timestamp is set the application can detect such empty frames and display the decoded video correctly. Copying sequence numbers was already discussed in January 2012 IIRC. The recommendation was that the device keeps an internal sequence counter and assigns it to both OUTPUT and CAPTURE buffers, so they can be associated. I think that we're diverting from the main topic of this discussion. My patches fix a problem and the only thing that, we cannot agree about is what the default timestamp type should be. Best wishes,
On Wed 23 January 2013 09:47:06 Kamil Debski wrote: > Hi, > > > From: 'Sakari Ailus' [mailto:sakari.ailus@iki.fi] > > Sent: Tuesday, January 22, 2013 7:45 PM > > > > Hi Kamil, > > > > On Tue, Jan 22, 2013 at 06:58:09PM +0100, Kamil Debski wrote: > > ... > > > > OTOH I'm not certain what's the main purpose of such copied > > > > timestamps, is it to identify which CAPTURE buffer comes from which > > OUTPUT buffer ? > > > > > > > > > > Yes, indeed. This is especially useful when the CAPTURE buffers can > > be > > > returned in an order different than the order of corresponding OUTPUT > > > buffers. > > > > How about sequence numbers then? Shouldn't that be also copied? > > > > If you're interested in the order alone, comparing the sequence numbers > > is a better way to figure out the order. That does require strict one- > > to-one mapping between the output and capture buffers, though, and that > > does not help in knowing when it might be a good time to display a > > frame, for instance. > > > > The idea behind copying the timestamp was that it can propagate the > timestamp > from the video stream. If this info is absent application can generate them > and > still be able to connect OUTPUT and CAPTURE frames. > > While decoding MPEG4 it is possible to get a compressed frame saying > "nothing > to do here, move along" (which basically means that the last frame should be > repeated). > This is where increasing sequence number comes in handy. Even if no > timestamp > is set the application can detect such empty frames and display the decoded > video > correctly. > > Copying sequence numbers was already discussed in January 2012 IIRC. The > recommendation > was that the device keeps an internal sequence counter and assigns it to > both OUTPUT and > CAPTURE buffers, so they can be associated. > > I think that we're diverting from the main topic of this discussion. My > patches fix a > problem and the only thing that, we cannot agree about is what the default > timestamp type > should be. Right. And in my view there should be no default timestamp. Drivers should always select MONOTONIC or COPY, and never UNKNOWN. The vb2 code should check for that and issue a WARN_ON if no proper timestamp type was provided. v4l2-compliance already checks for that as well. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jan 23, 2013 at 10:03:47AM +0100, Hans Verkuil wrote: ... > Right. And in my view there should be no default timestamp. Drivers should > always select MONOTONIC or COPY, and never UNKNOWN. The vb2 code should > check for that and issue a WARN_ON if no proper timestamp type was provided. > > v4l2-compliance already checks for that as well. I agree with that. Speaking of non-vb2 drivers --- I guess there's no reason for a driver not to use vb2 these days. There are actually already multple reasons to use it instead. So, vb2 drivers should choose the timestamps, and non-vb2 drivers... well, we shouldn't have more, but in case we do, they _must_ set the timestamp type, as there's no "default" since the relevant IOCTLs are handled by the driver itself rather than the V4L2 framework.
Hi, > From: 'Sakari Ailus' [mailto:sakari.ailus@iki.fi] > Sent: Wednesday, January 23, 2013 2:55 PM > > On Wed, Jan 23, 2013 at 10:03:47AM +0100, Hans Verkuil wrote: > ... > > Right. And in my view there should be no default timestamp. Drivers > > should always select MONOTONIC or COPY, and never UNKNOWN. The vb2 > > code should check for that and issue a WARN_ON if no proper timestamp > type was provided. > > > > v4l2-compliance already checks for that as well. > > I agree with that. I also agree. I will post patches that issue a WARN_ON. > Speaking of non-vb2 drivers --- I guess there's no reason for a driver > not to use vb2 these days. There are actually already multple reasons > to use it instead. > > So, vb2 drivers should choose the timestamps, and non-vb2 drivers... > well, we shouldn't have more, but in case we do, they _must_ set the > timestamp type, as there's no "default" since the relevant IOCTLs are > handled by the driver itself rather than the V4L2 framework. > Best wishes,
Hi Kamil, On Wednesday 23 January 2013 09:46:53 Kamil Debski wrote: > On Wednesday, January 23, 2013 1:26 AM Laurent Pinchart wrote: > > On Tuesday 22 January 2013 11:24:09 Kamil Debski wrote: > > > On Tuesday, January 22, 2013 11:03 AM Sakari Ailus wrote: > > > > On Mon, Jan 21, 2013 at 03:07:55PM +0100, Kamil Debski wrote: > > > > > On Saturday, January 19, 2013 6:43 PM Sakari Ailus wrote: > > > > > > On Mon, Jan 14, 2013 at 10:36:04AM +0100, Kamil Debski wrote: > > > > > > > Set proper timestamp type in drivers that I am sure that use > > > > > > > either MONOTONIC or COPY timestamps. Other drivers will > > > > > > > correctly report UNKNOWN timestamp type instead of assuming > > > > > > > that all drivers use monotonic timestamps. > > > > > > > > > > > > What other kind of timestamps there can be? All drivers (at > > > > > > least those not mem-to-mem) that do obtain timestamps using > > > > > > system clock use monotonic ones. > > > > > > > > > > Not set. It is not a COPY or MONOTONIC either. Any new or custom > > > > > kind of timestamp, maybe? > > > > > > > > Then new timestamp types should be defined for the purpose. Which > > > > is indeed what your patch is about. > > > > > > > > And about "COPY" timestamps: if an application wants to use > > > > timestamps, it probably need to know what kind of timestamps they > > > > are. "COPY" doesn't provide that information as such. Only the program > > > > that sets the timestamps for the OUTPUT buffers does. > > > > > > For me the COPY type is clear. If the app gets a COPY timestamp on a > > > buffer (CAPTURE) then it knows that it was copied from the OUTPUT > > > buffer. > > > > > > If the application did not set the timestamp for OUTPUT buffer, then > > > it has to cope with the consequences. > > > > > > > > > I'd think that there should no longer be any drivers using the > > > > > > UNKNOWN timestamp type: UNKNOWN is either from monotonic or > > > > > > realtime clock, and we just replaced all of them with the > > > > > > monotonic ones. No driver uses realtime timestamps anymore. > > > > > > > > > > Maybe there should be no drivers using UNKNOWN. But definitely > > > > > there should be no driver reporting MONOTONIC when the timestamp > > > > > is not monotonic. > > > > > > > > > > > How about making MONOTONIC timestamps default instead, or at > > > > > > least assigning all drivers something else than UNKNOWN? > > > > > > > > > > So why did you add the UNKNOWN flag? > > > > > > > > This is for API compatibility only. Applications running on kernels > > > > prior to the headers of which define timestamp types will not have > > > > timestamp type set (i.e. is zero, which equals to UNKNOWN). There > > > > was a lengthy discussion on the topic back then, and the conclusion > > > > was that the kernel version itself isn't enough to tell what kind of > > > > timestamps are provided to the user. > > > > > > > > Any new driver shouldn't use UNKNOWN timestamps since in this case > > > > the application would have to know what kind of timestamps the > > > > driver uses --- which is why we now specify it in the API. > > > > > > > > > The way I see it - UNKNOWN is the default and the one who coded > > > > > the driver will set it to either MONOTONIC or COPY if it is one of > > > > > these two. It won't be changed otherwise. There are drivers, which > > > > > do not fill the timestamp field at all: > > > > > - drivers/media/platform/coda.c > > > > > - drivers/media/platform/exynos-gsc/gsc-m2m.c > > > > > - drivers/media/platform/m2m-deinterlace.c > > > > > - drivers/media/platform/mx2_emmaprp.c > > > > > - drivers/media/platform/s5p-fimc/fimc-m2m.c > > > > > - drivers/media/platform/s5p-g2d.c > > > > > - drivers/media/platform/s5p-jpeg/jpeg-core.c > > > > > > > > Excellent point. > > > > > > > > But --- should these drivers then fill the timestamp field? Isn't it > > > > a bug in the driver not to do so? > > > > > > Could be. The only thing I am complaining about is that the type > > > should not be reported as monotonic when it is not. > > > > Of course. > > > > > (We can argue that constant is monotonic, but I think that it is not > > > the point :-) ). This is why I propose to leave UNKNOWN as the default > > > choice (which it is in case of non videobuf2 drivers). It is possible > > > to eliminate the UNKNOWN in my opinion, but it should be up to the > > > programmer to set the type. Another option is to eliminate the UNKNOWN > > > flag in the next, or in two kernel releases. After the drivers are > > > changed. Still I prefer to leave the driver's programmer in charge and > > > leave the UNKNOWN type. > > > > I think that Sakari's point is that all non mem-to-mem drivers should > > use the MONOTONIC timestamps type. > > Good point. I didn't say they should not. It's all ok with me. > > > UNKNOWN, in the non mem-to-mem case, > > is only meant for compatibility with older kernels. We should thus > > default to MONOTONIC and let drivers select a different timestamp type > > when needed (for mem-to-mem drivers for instance). > > I can agree with that if the MONOTONIC is a real default. Not videobuf2 > exclusive default. In case of non vb2 drivers the default (driver does > not set the timestamp type flag at all) is UNKNOWN. > > I would expect that if no action on the programmer side is taken then > videobuf2 and non videobuf2 drivers would act in a similar way. > > Laurent, I really think that it may confuse someone. I think the MONOTONIC > timestamp type should indicate a driver that supplies a monotonic timestamp. > Not a newer kernel that sets it as default (and it does only in case of vb2 > drivers, not others). If I understand it correctly, the timestamp flag reports the timestamp field format to the application. Possible values are - UNKNOWN: No information is available about the timestamp format. - MONOTONIC: The timestamp is taken from the monotonic clock. UNKNOWN was the value reported by all drivers before v3.7, as no information was available about timestamps. Starting from v3.7 all capture drivers have been converted to supply monotonic timestamps, and thus to report the MONOTONIC timestamp format (videobuf and videobuf2 now hardcode the MONOTONIC flag, and drivers that use neither set the flag manually). As mem-to-mem drivers need to report a different timestamp we can't hardcode the MONOTONIC flag anymore in videobuf(2). A patch that allows selecting the timestamp type in videobuf(2) thus makes sense, but we don't want to revert to the UNKNOWN timestamp type for all capture drivers. > > > > > The way you did it in your patches left no room for any kind of > > > > > choice. I did comment at least twice about mem-2-mem devices in > > > > > your RFCs, if I remember correctly. I think Sylwester was also > > > > > writing about this. Still everything got marked as MONOTONIC. > > > > > > > > I must have missed this in the discussion back then. > > > > > > > > > If we were to assume that there were no other timestamp types then > > > > > monotonic (which is not true, but this was your assumption), then > > > > > what was the reason to add this timestamp framework? > > > > > > > > For capture devices whose video source has no native timestamps the > > > > timestamps are MONOTONIC, at least until it is made selectable. > > > > Other examples could include video decoders or encoders, but these > > > > timestamps will be entirely different kind, and probably doesn't end > > > > up to the timestamp field.
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index d422d3c..365d6ef 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c @@ -939,6 +939,7 @@ static int __devinit bcap_probe(struct platform_device *pdev) q->buf_struct_size = sizeof(struct bcap_buffer); q->ops = &bcap_video_qops; q->mem_ops = &vb2_dma_contig_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; vb2_queue_init(q); diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 5892d2b..1943e41 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1035,6 +1035,7 @@ static int vpif_reqbufs(struct file *file, void *priv, q->ops = &video_qops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct vpif_cap_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) { diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index dd249c9..5477c2c 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1001,6 +1001,7 @@ static int vpif_reqbufs(struct file *file, void *priv, q->ops = &video_qops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct vpif_disp_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) { diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index a55793c..e91f350 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -1153,6 +1153,7 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx) q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct camif_buffer); q->drv_priv = vp; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c index ddd689b..02cfb2b 100644 --- a/drivers/media/platform/s5p-fimc/fimc-capture.c +++ b/drivers/media/platform/s5p-fimc/fimc-capture.c @@ -1747,6 +1747,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, q->ops = &fimc_capture_qops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct fimc_vid_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c index 1b309a7..39ea893 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c @@ -1251,6 +1251,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct flite_buffer); q->drv_priv = fimc; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret < 0) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index a527f85..30b4d15 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -807,6 +807,7 @@ static int s5p_mfc_open(struct file *file) goto err_queue_init; } q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q); if (ret) { mfc_err("Failed to initialize videobuf2 queue(capture)\n"); @@ -828,6 +829,7 @@ static int s5p_mfc_open(struct file *file) goto err_queue_init; } q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q); if (ret) { mfc_err("Failed to initialize videobuf2 queue(output)\n"); diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index c8d748a..e531b82 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -514,6 +514,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, q->buf_struct_size = sizeof(struct frame_buffer); q->ops = &isi_video_qops; q->mem_ops = &vb2_dma_contig_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; return vb2_queue_init(q); } diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 5fbac4f..5ff6a5d 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c @@ -1022,6 +1022,7 @@ static int mx2_camera_init_videobuf(struct vb2_queue *q, q->ops = &mx2_videobuf_ops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct mx2_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; return vb2_queue_init(q); } diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 574d125..abe9db6 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c @@ -455,6 +455,7 @@ static int mx3_camera_init_videobuf(struct vb2_queue *q, q->ops = &mx3_videobuf_ops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct mx3_camera_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; return vb2_queue_init(q); } diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 8a6d58d..b6c1c97 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -2026,6 +2026,7 @@ static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q, q->ops = &sh_mobile_ceu_videobuf_ops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct sh_mobile_ceu_buffer); + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; return vb2_queue_init(q); } diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c index c2f424f..86a5432 100644 --- a/drivers/media/platform/vivi.c +++ b/drivers/media/platform/vivi.c @@ -1305,6 +1305,7 @@ static int __init vivi_create_instance(int inst) q->buf_struct_size = sizeof(struct vivi_buffer); q->ops = &vivi_video_qops; q->mem_ops = &vb2_vmalloc_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(q); if (ret) diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 21c1523..1b65e0c 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -1001,6 +1001,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf); pdev->vb_queue.ops = &pwc_vb_queue_ops; pdev->vb_queue.mem_ops = &vb2_vmalloc_memops; + pdev->vb_queue.timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; rc = vb2_queue_init(&pdev->vb_queue); if (rc < 0) { PWC_ERROR("Oops, could not initialize vb2 queue.\n"); diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index 6694f9e..5307a63 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -687,6 +687,7 @@ int stk1160_vb2_setup(struct stk1160 *dev) q->buf_struct_size = sizeof(struct stk1160_buffer); q->ops = &stk1160_video_qops; q->mem_ops = &vb2_vmalloc_memops; + q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; rc = vb2_queue_init(q); if (rc < 0) diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 778addc..82d01d8 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -133,6 +133,7 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, queue->queue.buf_struct_size = sizeof(struct uvc_buffer); queue->queue.ops = &uvc_queue_qops; queue->queue.mem_ops = &vb2_vmalloc_memops; + queue->queue.timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ret = vb2_queue_init(&queue->queue); if (ret) return ret;