d/v4l2: Add tracing support

This commit is contained in:
Jakob Bornecrantz 2021-07-09 21:43:21 +01:00
parent c278618ec1
commit 09513d73af
2 changed files with 14 additions and 5 deletions

View file

@ -241,7 +241,11 @@ if(XRT_HAVE_V4L2)
)
add_library(drv_v4l2 STATIC ${V4L2_SOURCE_FILES})
target_link_libraries(drv_v4l2 PRIVATE xrt-interfaces aux_os)
target_link_libraries(drv_v4l2 PRIVATE
xrt-interfaces
aux_os
aux_util
)
list(APPEND ENABLED_DRIVERS v4l2)
endif()

View file

@ -1,4 +1,4 @@
// Copyright 2019, Collabora, Ltd.
// Copyright 2019-2021, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -15,6 +15,7 @@
#include "util/u_debug.h"
#include "util/u_format.h"
#include "util/u_logging.h"
#include "util/u_trace_marker.h"
#include "v4l2_interface.h"
@ -168,7 +169,7 @@ struct v4l2_fs
* Streaming thread entrypoint
*/
static void *
v4l2_fs_stream_run(void *ptr);
v4l2_fs_mainloop(void *ptr);
/*!
* Cast to derived type.
@ -661,7 +662,7 @@ v4l2_fs_stream_start(struct xrt_fs *xfs,
vid->sink = xs;
vid->is_running = true;
vid->capture_type = capture_type;
if (pthread_create(&vid->stream_thread, NULL, v4l2_fs_stream_run, xfs)) {
if (pthread_create(&vid->stream_thread, NULL, v4l2_fs_mainloop, xfs)) {
vid->is_running = false;
V4L2_ERROR(vid, "error: Could not create thread");
return false;
@ -799,8 +800,10 @@ v4l2_fs_create(struct xrt_frame_context *xfctx,
}
void *
v4l2_fs_stream_run(void *ptr)
v4l2_fs_mainloop(void *ptr)
{
SINK_TRACE_MARKER();
struct xrt_fs *xfs = (struct xrt_fs *)ptr;
struct v4l2_fs *vid = v4l2_fs(xfs);
@ -906,6 +909,8 @@ v4l2_fs_stream_run(void *ptr)
v4l2_update_controls(vid);
SINK_TRACE_IDENT(v4l2_fs_frame);
V4L2_TRACE(vid, "Got frame #%u, index %i", v_buf.sequence, v_buf.index);
struct v4l2_frame *vf = &vid->frames[v_buf.index];