From 422bc707e5de3a9770108ce84e8910c272f8801f Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 3 Jan 2019 15:40:36 +0100 Subject: [PATCH 72/76] xlat: update V4L2_BUF_TYPE_* constants * xlat/v4l2_buf_types.in: Add fallback definitions for constants, mention V4L2_BUF_TYPE_PRIVATE in comment, add #value_indexed. * configure.ac (AC_CHECK_MEMBERS): Add checks for struct v4l2_format.fmt.pix_mp, struct v4l2_format.fmt.sdr, and struct v4l2_format.fmt.sliced. * v4l2.c (print_v4l2_format_fmt): Use the relevant HAVE_STRUCT_* macros instead of HAVE_DECL_V4L2_BUF_TYPE_*. --- configure.ac | 3 +++ v4l2.c | 10 +++------- xlat/v4l2_buf_types.in | 29 +++++++++++++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) Index: strace-5.1/configure.ac =================================================================== --- strace-5.1.orig/configure.ac 2020-01-29 12:39:33.198682164 +0100 +++ strace-5.1/configure.ac 2020-01-29 12:39:56.946464178 +0100 @@ -779,6 +779,9 @@ AC_CHECK_MEMBERS(m4_normalize([ struct v4l2_capability.device_caps, + struct v4l2_format.fmt.pix_mp, + struct v4l2_format.fmt.sdr, + struct v4l2_format.fmt.sliced, struct v4l2_window.global_alpha, struct v4l2_sdr_format.buffersize ]),,, [#include Index: strace-5.1/v4l2.c =================================================================== --- strace-5.1.orig/v4l2.c 2020-01-29 12:39:33.199682155 +0100 +++ strace-5.1/v4l2.c 2020-01-29 12:39:56.947464169 +0100 @@ -204,7 +204,7 @@ "V4L2_COLORSPACE_???"); tprints("}"); break; -#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE +#if HAVE_STRUCT_V4L2_FORMAT_FMT_PIX_MP case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: { unsigned int i, max; @@ -235,9 +235,7 @@ } #endif /* OUTPUT_OVERLAY since Linux v2.6.22-rc1~1118^2~179 */ -#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: -#endif case V4L2_BUF_TYPE_VIDEO_OVERLAY: { struct_v4l2_clip clip; tprints(prefix); @@ -272,7 +270,7 @@ tprints("}"); break; /* both since Linux v2.6.14-rc2~64 */ -#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE +#if HAVE_STRUCT_V4L2_FORMAT_FMT_SLICED case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: { unsigned int i, j; @@ -301,12 +299,10 @@ break; } #endif +#if HAVE_STRUCT_V4L2_FORMAT_FMT_SDR /* since Linux v4.4-rc1~118^2~14 */ -#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT case V4L2_BUF_TYPE_SDR_OUTPUT: -#endif /* since Linux v3.15-rc1~85^2~213 */ -#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE case V4L2_BUF_TYPE_SDR_CAPTURE: tprints(prefix); tprints("fmt.sdr={pixelformat="); Index: strace-5.1/xlat/v4l2_buf_types.in =================================================================== --- strace-5.1.orig/xlat/v4l2_buf_types.in 2019-01-05 22:14:42.000000000 +0100 +++ strace-5.1/xlat/v4l2_buf_types.in 2020-01-29 12:39:56.948464160 +0100 @@ -1,14 +1,15 @@ -V4L2_BUF_TYPE_VIDEO_CAPTURE -V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE -V4L2_BUF_TYPE_VIDEO_OUTPUT -V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE -V4L2_BUF_TYPE_VIDEO_OVERLAY -V4L2_BUF_TYPE_VBI_CAPTURE -V4L2_BUF_TYPE_VBI_OUTPUT -V4L2_BUF_TYPE_SLICED_VBI_CAPTURE -V4L2_BUF_TYPE_SLICED_VBI_OUTPUT -V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY -V4L2_BUF_TYPE_SDR_CAPTURE -V4L2_BUF_TYPE_SDR_OUTPUT -V4L2_BUF_TYPE_META_CAPTURE -V4L2_BUF_TYPE_META_OUTPUT +V4L2_BUF_TYPE_VIDEO_CAPTURE 1 +V4L2_BUF_TYPE_VIDEO_OUTPUT 2 +V4L2_BUF_TYPE_VIDEO_OVERLAY 3 +V4L2_BUF_TYPE_VBI_CAPTURE 4 +V4L2_BUF_TYPE_VBI_OUTPUT 5 +V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 6 +V4L2_BUF_TYPE_SLICED_VBI_OUTPUT 7 +V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY 8 +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 9 +V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 10 +V4L2_BUF_TYPE_SDR_CAPTURE 11 +V4L2_BUF_TYPE_SDR_OUTPUT 12 +V4L2_BUF_TYPE_META_CAPTURE 13 +V4L2_BUF_TYPE_META_OUTPUT 14 +/* V4L2_BUF_TYPE_PRIVATE 0x80 */ Index: strace-5.1/xlat/v4l2_buf_types.h =================================================================== --- strace-5.1.orig/xlat/v4l2_buf_types.h 2019-05-22 15:08:31.000000000 +0200 +++ strace-5.1/xlat/v4l2_buf_types.h 2020-01-29 12:40:07.413368100 +0100 @@ -3,61 +3,132 @@ #include "gcc_compat.h" #include "static_assert.h" - -#ifndef XLAT_MACROS_ONLY - -# ifdef IN_MPERS - -extern const struct xlat v4l2_buf_types[]; - -# else - -# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) -static -# endif -const struct xlat v4l2_buf_types[] = { #if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE) - XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE), -#endif -#if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) - XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_CAPTURE) == (1), "V4L2_BUF_TYPE_VIDEO_CAPTURE != 1"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_CAPTURE 1 #endif #if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT) - XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT), -#endif -#if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT) == (2), "V4L2_BUF_TYPE_VIDEO_OUTPUT != 2"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_OUTPUT 2 #endif #if defined(V4L2_BUF_TYPE_VIDEO_OVERLAY) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OVERLAY) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OVERLAY) - XLAT(V4L2_BUF_TYPE_VIDEO_OVERLAY), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_OVERLAY) == (3), "V4L2_BUF_TYPE_VIDEO_OVERLAY != 3"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_OVERLAY 3 #endif #if defined(V4L2_BUF_TYPE_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE) - XLAT(V4L2_BUF_TYPE_VBI_CAPTURE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VBI_CAPTURE) == (4), "V4L2_BUF_TYPE_VBI_CAPTURE != 4"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VBI_CAPTURE 4 #endif #if defined(V4L2_BUF_TYPE_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VBI_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_VBI_OUTPUT) - XLAT(V4L2_BUF_TYPE_VBI_OUTPUT), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VBI_OUTPUT) == (5), "V4L2_BUF_TYPE_VBI_OUTPUT != 5"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VBI_OUTPUT 5 #endif #if defined(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) - XLAT(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) == (6), "V4L2_BUF_TYPE_SLICED_VBI_CAPTURE != 6"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 6 #endif #if defined(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) - XLAT(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) == (7), "V4L2_BUF_TYPE_SLICED_VBI_OUTPUT != 7"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_SLICED_VBI_OUTPUT 7 #endif #if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) - XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) == (8), "V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY != 8"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY 8 +#endif +#if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) == (9), "V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE != 9"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 9 +#endif +#if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) == (10), "V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE != 10"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 10 #endif #if defined(V4L2_BUF_TYPE_SDR_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE) - XLAT(V4L2_BUF_TYPE_SDR_CAPTURE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_SDR_CAPTURE) == (11), "V4L2_BUF_TYPE_SDR_CAPTURE != 11"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_SDR_CAPTURE 11 #endif #if defined(V4L2_BUF_TYPE_SDR_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT) - XLAT(V4L2_BUF_TYPE_SDR_OUTPUT), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_SDR_OUTPUT) == (12), "V4L2_BUF_TYPE_SDR_OUTPUT != 12"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_SDR_OUTPUT 12 #endif #if defined(V4L2_BUF_TYPE_META_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_META_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_META_CAPTURE) - XLAT(V4L2_BUF_TYPE_META_CAPTURE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_META_CAPTURE) == (13), "V4L2_BUF_TYPE_META_CAPTURE != 13"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_META_CAPTURE 13 #endif #if defined(V4L2_BUF_TYPE_META_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_META_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_META_OUTPUT) - XLAT(V4L2_BUF_TYPE_META_OUTPUT), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_TYPE_META_OUTPUT) == (14), "V4L2_BUF_TYPE_META_OUTPUT != 14"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_TYPE_META_OUTPUT 14 #endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_buf_types[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_buf_types[] = { + XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE), + XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT), + XLAT(V4L2_BUF_TYPE_VIDEO_OVERLAY), + XLAT(V4L2_BUF_TYPE_VBI_CAPTURE), + XLAT(V4L2_BUF_TYPE_VBI_OUTPUT), + XLAT(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE), + XLAT(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT), + XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY), + XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE), + XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE), + XLAT(V4L2_BUF_TYPE_SDR_CAPTURE), + XLAT(V4L2_BUF_TYPE_SDR_OUTPUT), + XLAT(V4L2_BUF_TYPE_META_CAPTURE), + XLAT(V4L2_BUF_TYPE_META_OUTPUT), + XLAT_END };