diff mbox series

v4l2-tracer fails to compile after syncing to latest kernel headers

Message ID 0af44b62-4c18-4ec1-ba83-cca712a53acb@xs4all.nl
State New
Headers show
Series v4l2-tracer fails to compile after syncing to latest kernel headers | expand

Commit Message

Hans Verkuil Oct. 17, 2023, 8:40 a.m. UTC
Hi Deb,

I wanted to sync the kernel headers used in v4l-utils to the latest versions,
but that caused v4l2-tracer to fail on the new AV1 struct.

To test this yourself, go to your checked out kernel git repo and run
make headers_install:

cd kernel-repo-dir
make headers_install

Next to go the v4l-utils directory and run:

sync-with-kernel.sh path-to-kernel-repo-dir

Next build v4l-utils.

There are two issues:

1) v4l2-trace doesn't support the new AV1 struct, at least this patch is needed:



And even with that it fails to compile:

$ ninja -C build
ninja: Entering directory `build'
[1/5] Compiling C++ object utils/v4l2-tracer/libv4l2tracer.so.p/meson-generated_.._trace-gen.cpp.o
FAILED: utils/v4l2-tracer/libv4l2tracer.so.p/meson-generated_.._trace-gen.cpp.o
ccache c++ -Iutils/v4l2-tracer/libv4l2tracer.so.p -Iutils/v4l2-tracer -I../utils/v4l2-tracer -I../utils/common -I../lib/include -I../include -I/usr/include/json-c -fdiagnostics-color=always
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu++11 -O2 -g -Wpointer-arith -D_GNU_SOURCE -DPROMOTED_MODE_T=int -DENABLE_NLS -include /home/hans/work/src/v4l/v4l-utils/build/config.h -fPIC
-U_FILE_OFFSET_BITS -D_FILE_OFFSET_BITS=32 -D_LARGEFILE64_SOURCE -MD -MQ utils/v4l2-tracer/libv4l2tracer.so.p/meson-generated_.._trace-gen.cpp.o -MF
utils/v4l2-tracer/libv4l2tracer.so.p/meson-generated_.._trace-gen.cpp.o.d -o utils/v4l2-tracer/libv4l2tracer.so.p/meson-generated_.._trace-gen.cpp.o -c utils/v4l2-tracer/trace-gen.cpp
utils/v4l2-tracer/trace-gen.cpp: In function ‘void trace_v4l2_av1_global_motion_gen(void*, json_object*)’:
utils/v4l2-tracer/trace-gen.cpp:1193:49: error: ‘json_object_new_’ was not declared in this scope; did you mean ‘json_object_new_int’?
 1193 |                 json_object_array_add(type_obj, json_object_new_(p->type[i]));
      |                                                 ^~~~~~~~~~~~~~~~
      |                                                 json_object_new_int
utils/v4l2-tracer/trace-gen.cpp: In function ‘void trace_v4l2_av1_loop_restoration_gen(void*, json_object*)’:
utils/v4l2-tracer/trace-gen.cpp:1220:67: error: ‘json_object_new_’ was not declared in this scope; did you mean ‘json_object_new_int’?
 1220 |                 json_object_array_add(frame_restoration_type_obj, json_object_new_(p->frame_restoration_type[i]));
      |                                                                   ^~~~~~~~~~~~~~~~
      |                                                                   json_object_new_int
...

I suspect the parsing of the header failed here. So either the parser or the v4l2-controls.h
header (or both!) likely need work.

Can you take a look?

Regards,

	Hans
diff mbox series

Patch

diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp
index 88e70ea9..06d4f62a 100644
--- a/utils/v4l2-tracer/retrace.cpp
+++ b/utils/v4l2-tracer/retrace.cpp
@@ -872,6 +872,18 @@  struct v4l2_ext_control *retrace_v4l2_ext_control(json_object *parent_obj, int c
 	case V4L2_CID_STATELESS_MPEG2_QUANTISATION:
 		p->ptr = retrace_v4l2_ctrl_mpeg2_quantisation_gen(v4l2_ext_control_obj);
 		break;
+	case V4L2_CID_STATELESS_AV1_SEQUENCE:
+		p->ptr = retrace_v4l2_ctrl_av1_sequence_gen(v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY:
+		p->ptr = retrace_v4l2_ctrl_av1_tile_group_entry_gen(v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_FRAME:
+		p->ptr = retrace_v4l2_ctrl_av1_frame_gen(v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_FILM_GRAIN:
+		p->ptr = retrace_v4l2_ctrl_av1_film_grain_gen(v4l2_ext_control_obj);
+		break;
 	default:
 		line_info("\n\tWarning: cannot retrace control: %s",
 		          val2s(p->id, control_val_def).c_str());
diff --git a/utils/v4l2-tracer/trace.cpp b/utils/v4l2-tracer/trace.cpp
index 0e8531ff..4ddac491 100644
--- a/utils/v4l2-tracer/trace.cpp
+++ b/utils/v4l2-tracer/trace.cpp
@@ -407,6 +407,18 @@  void trace_v4l2_ext_control(void *arg, json_object *parent_obj, std::string key_
 	case V4L2_CID_STATELESS_MPEG2_QUANTISATION:
 		trace_v4l2_ctrl_mpeg2_quantisation_gen(p->p_mpeg2_quantisation, v4l2_ext_control_obj);
 		break;
+	case V4L2_CID_STATELESS_AV1_SEQUENCE:
+		trace_v4l2_ctrl_av1_sequence_gen(p->p_av1_sequence, v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY:
+		trace_v4l2_ctrl_av1_tile_group_entry_gen(p->p_av1_tile_group_entry, v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_FRAME:
+		trace_v4l2_ctrl_av1_frame_gen(p->p_av1_frame, v4l2_ext_control_obj);
+		break;
+	case V4L2_CID_STATELESS_AV1_FILM_GRAIN:
+		trace_v4l2_ctrl_av1_film_grain_gen(p->p_av1_film_grain, v4l2_ext_control_obj);
+		break;
 	case V4L2_CID_MPEG_VIDEO_DEC_PTS:
 	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
 	case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR: