Add tracing and retracing for VIDIOC_ENUM_FRAMEINTERVALS ioctl. Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx> --- utils/v4l2-tracer/libv4l2tracer.cpp | 1 + utils/v4l2-tracer/retrace.cpp | 16 ++++++++++++++++ utils/v4l2-tracer/trace.cpp | 3 +++ utils/v4l2-tracer/v4l2-tracer-gen.pl | 9 +++++++++ 4 files changed, 29 insertions(+) diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp index 6edec7f4..58a02656 100644 --- a/utils/v4l2-tracer/libv4l2tracer.cpp +++ b/utils/v4l2-tracer/libv4l2tracer.cpp @@ -41,6 +41,7 @@ const std::list<unsigned long> ioctls = { VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS, VIDIOC_ENUM_FRAMESIZES, + VIDIOC_ENUM_FRAMEINTERVALS, VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD, VIDIOC_CREATE_BUFS, diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp index 7003ca70..28dc6afe 100644 --- a/utils/v4l2-tracer/retrace.cpp +++ b/utils/v4l2-tracer/retrace.cpp @@ -978,6 +978,19 @@ void retrace_vidioc_enum_framesizes(int fd_retrace, json_object *ioctl_args) free(ptr); } +void retrace_vidioc_enum_frameintervals(int fd_retrace, json_object *ioctl_args) +{ + struct v4l2_frmivalenum *ptr = retrace_v4l2_frmivalenum_gen(ioctl_args); + + ioctl(fd_retrace, VIDIOC_ENUM_FRAMEINTERVALS, ptr); + + if (is_verbose() || (errno != 0)) + perror("VIDIOC_ENUM_FRAMEINTERVALS"); + + free(ptr); +} + + void retrace_vidioc_try_encoder_cmd(int fd_retrace, json_object *ioctl_args) { struct v4l2_encoder_cmd *ptr = retrace_v4l2_encoder_cmd_gen(ioctl_args); @@ -1287,6 +1300,9 @@ void retrace_ioctl(json_object *syscall_obj) case VIDIOC_ENUM_FRAMESIZES: retrace_vidioc_enum_framesizes(fd_retrace, ioctl_args_user); break; + case VIDIOC_ENUM_FRAMEINTERVALS: + retrace_vidioc_enum_frameintervals(fd_retrace, ioctl_args_user); + break; case VIDIOC_TRY_ENCODER_CMD: retrace_vidioc_try_encoder_cmd(fd_retrace, ioctl_args_user); break; diff --git a/utils/v4l2-tracer/trace.cpp b/utils/v4l2-tracer/trace.cpp index 78db2554..5049a996 100644 --- a/utils/v4l2-tracer/trace.cpp +++ b/utils/v4l2-tracer/trace.cpp @@ -592,6 +592,9 @@ json_object *trace_ioctl_args(unsigned long cmd, void *arg) case VIDIOC_ENUM_FRAMESIZES: trace_v4l2_frmsizeenum_gen(arg, ioctl_args); break; + case VIDIOC_ENUM_FRAMEINTERVALS: + trace_v4l2_frmivalenum_gen(arg, ioctl_args); + break; case VIDIOC_TRY_ENCODER_CMD: case VIDIOC_ENCODER_CMD: trace_v4l2_encoder_cmd_gen(arg, ioctl_args); diff --git a/utils/v4l2-tracer/v4l2-tracer-gen.pl b/utils/v4l2-tracer/v4l2-tracer-gen.pl index aaa112c1..f3eb87bb 100755 --- a/utils/v4l2-tracer/v4l2-tracer-gen.pl +++ b/utils/v4l2-tracer/v4l2-tracer-gen.pl @@ -372,6 +372,15 @@ sub handle_union { printf $fh_trace_cpp "\tdefault:\n\t\tbreak;\n\t}\n"; } + if ($struct_name eq "v4l2_frmivalenum") { + printf $fh_trace_cpp "\tswitch (p->type) {\n"; + printf $fh_trace_cpp "\tcase V4L2_FRMIVAL_TYPE_DISCRETE:\n"; + printf $fh_trace_cpp "\t\ttrace_v4l2_fract_gen(&p->discrete, %s_obj);\n\t\tbreak;\n", $struct_name; + printf $fh_trace_cpp "\tcase V4L2_FRMIVAL_TYPE_STEPWISE:\n\tcase V4L2_FRMIVAL_TYPE_CONTINUOUS:\n"; + printf $fh_trace_cpp "\t\ttrace_v4l2_frmival_stepwise_gen(&p->stepwise, %s_obj);\n\t\tbreak;\n", $struct_name; + printf $fh_trace_cpp "\tdefault:\n\t\tbreak;\n\t}\n"; + } + return $suppress_union; } -- 2.40.1