mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
media: uvcvideo: Use ktime_t for stats
'struct timespec' works fine here, but we try to migrate away from it in favor of ktime_t or timespec64. In this case, using ktime_t produces the simplest code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
6f0e5fd391
commit
a70b8b24e7
2 changed files with 6 additions and 9 deletions
|
@ -725,7 +725,7 @@ static void uvc_video_stats_decode(struct uvc_streaming *stream,
|
||||||
|
|
||||||
if (stream->stats.stream.nb_frames == 0 &&
|
if (stream->stats.stream.nb_frames == 0 &&
|
||||||
stream->stats.frame.nb_packets == 0)
|
stream->stats.frame.nb_packets == 0)
|
||||||
ktime_get_ts(&stream->stats.stream.start_ts);
|
stream->stats.stream.start_ts = ktime_get();
|
||||||
|
|
||||||
switch (data[1] & (UVC_STREAM_PTS | UVC_STREAM_SCR)) {
|
switch (data[1] & (UVC_STREAM_PTS | UVC_STREAM_SCR)) {
|
||||||
case UVC_STREAM_PTS | UVC_STREAM_SCR:
|
case UVC_STREAM_PTS | UVC_STREAM_SCR:
|
||||||
|
@ -865,16 +865,13 @@ size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
|
||||||
{
|
{
|
||||||
unsigned int scr_sof_freq;
|
unsigned int scr_sof_freq;
|
||||||
unsigned int duration;
|
unsigned int duration;
|
||||||
struct timespec ts;
|
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
ts = timespec_sub(stream->stats.stream.stop_ts,
|
|
||||||
stream->stats.stream.start_ts);
|
|
||||||
|
|
||||||
/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
|
/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
|
||||||
* frequency this will not overflow before more than 1h.
|
* frequency this will not overflow before more than 1h.
|
||||||
*/
|
*/
|
||||||
duration = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
duration = ktime_ms_delta(stream->stats.stream.stop_ts,
|
||||||
|
stream->stats.stream.start_ts);
|
||||||
if (duration != 0)
|
if (duration != 0)
|
||||||
scr_sof_freq = stream->stats.stream.scr_sof_count * 1000
|
scr_sof_freq = stream->stats.stream.scr_sof_count * 1000
|
||||||
/ duration;
|
/ duration;
|
||||||
|
@ -915,7 +912,7 @@ static void uvc_video_stats_start(struct uvc_streaming *stream)
|
||||||
|
|
||||||
static void uvc_video_stats_stop(struct uvc_streaming *stream)
|
static void uvc_video_stats_stop(struct uvc_streaming *stream)
|
||||||
{
|
{
|
||||||
ktime_get_ts(&stream->stats.stream.stop_ts);
|
stream->stats.stream.stop_ts = ktime_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
|
|
|
@ -457,8 +457,8 @@ struct uvc_stats_frame {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uvc_stats_stream {
|
struct uvc_stats_stream {
|
||||||
struct timespec start_ts; /* Stream start timestamp */
|
ktime_t start_ts; /* Stream start timestamp */
|
||||||
struct timespec stop_ts; /* Stream stop timestamp */
|
ktime_t stop_ts; /* Stream stop timestamp */
|
||||||
|
|
||||||
unsigned int nb_frames; /* Number of frames */
|
unsigned int nb_frames; /* Number of frames */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue