From 97a57bbf35066d436230fe004f9f44e524a6e807 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sun, 25 Nov 2018 16:14:11 +0100 Subject: [PATCH 77/82] v4l2: improve buffer flag decoding * xlat/v4l2_buf_flags.in: Add fallback values. * xlat/v4l2_buf_flags_masks.in: New file. * xlat/v4l2_buf_flags_ts_src.in: Likewise. * xlat/v4l2_buf_flags_ts_type.in: Likewise. * v4l2.c: Include xlat/v4l2_buf_flags_ts_type.h, xlat/v4l2_buf_flags_ts_src.h, xlat/v4l2_buf_flags_masks.h. (print_v4l2_buffer_flags): New function. (print_v4l2_buffer): Call print_v4l2_buffer_flags for printing flags field. --- v4l2.c | 25 ++++++++++++++++++++++++- xlat/v4l2_buf_flags.in | 33 ++++++++++++++------------------- xlat/v4l2_buf_flags_masks.in | 2 ++ xlat/v4l2_buf_flags_ts_src.in | 3 +++ xlat/v4l2_buf_flags_ts_type.in | 4 ++++ 5 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 xlat/v4l2_buf_flags_masks.in create mode 100644 xlat/v4l2_buf_flags_ts_src.in create mode 100644 xlat/v4l2_buf_flags_ts_type.in Index: strace-5.1/v4l2.c =================================================================== --- strace-5.1.orig/v4l2.c 2020-01-29 12:41:14.883725929 +0100 +++ strace-5.1/v4l2.c 2020-01-29 14:19:20.356865977 +0100 @@ -385,6 +385,29 @@ } #include "xlat/v4l2_buf_flags.h" +#include "xlat/v4l2_buf_flags_ts_type.h" +#include "xlat/v4l2_buf_flags_ts_src.h" + +#define XLAT_MACROS_ONLY +# include "xlat/v4l2_buf_flags_masks.h" +#undef XLAT_MACROS_ONLY + +static void +print_v4l2_buffer_flags(uint32_t val) +{ + const uint32_t ts_type = val & V4L2_BUF_FLAG_TIMESTAMP_MASK; + const uint32_t ts_src = val & V4L2_BUF_FLAG_TSTAMP_SRC_MASK; + const uint32_t flags = val & ~ts_type & ~ts_src; + + + printflags(v4l2_buf_flags, flags, "V4L2_BUF_FLAG_???"); + tprints("|"); + printxval(v4l2_buf_flags_ts_type, ts_type, + "V4L2_BUF_FLAG_TIMESTAMP_???"); + tprints("|"); + printxval(v4l2_buf_flags_ts_type, ts_src, + "V4L2_BUF_FLAG_TSTAMP_SRC_???"); +} static int print_v4l2_buffer(struct tcb *const tcp, const unsigned int code, @@ -419,7 +442,7 @@ tprintf(", length=%u, bytesused=%u, flags=", b.length, b.bytesused); - printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???"); + print_v4l2_buffer_flags(b.flags); if (code == VIDIOC_DQBUF) { tprints(", timestamp = "); MPERS_FUNC_NAME(print_struct_timeval)(&b.timestamp); Index: strace-5.1/xlat/v4l2_buf_flags.in =================================================================== --- strace-5.1.orig/xlat/v4l2_buf_flags.in 2017-04-07 03:21:36.000000000 +0200 +++ strace-5.1/xlat/v4l2_buf_flags.in 2020-01-29 14:19:20.357865967 +0100 @@ -1,19 +1,14 @@ -V4L2_BUF_FLAG_MAPPED -V4L2_BUF_FLAG_QUEUED -V4L2_BUF_FLAG_DONE -V4L2_BUF_FLAG_KEYFRAME -V4L2_BUF_FLAG_PFRAME -V4L2_BUF_FLAG_BFRAME -V4L2_BUF_FLAG_TIMECODE -V4L2_BUF_FLAG_INPUT -V4L2_BUF_FLAG_PREPARED -V4L2_BUF_FLAG_NO_CACHE_INVALIDATE -V4L2_BUF_FLAG_NO_CACHE_CLEAN -V4L2_BUF_FLAG_TIMESTAMP_MASK -V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN -V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC -V4L2_BUF_FLAG_TIMESTAMP_COPY -V4L2_BUF_FLAG_TSTAMP_SRC_MASK -V4L2_BUF_FLAG_TSTAMP_SRC_EOF -V4L2_BUF_FLAG_TSTAMP_SRC_SOE -V4L2_BUF_FLAG_LAST +V4L2_BUF_FLAG_MAPPED 0x00000001 +V4L2_BUF_FLAG_QUEUED 0x00000002 +V4L2_BUF_FLAG_DONE 0x00000004 +V4L2_BUF_FLAG_KEYFRAME 0x00000008 +V4L2_BUF_FLAG_PFRAME 0x00000010 +V4L2_BUF_FLAG_BFRAME 0x00000020 +V4L2_BUF_FLAG_ERROR 0x00000040 +V4L2_BUF_FLAG_IN_REQUEST 0x00000080 +V4L2_BUF_FLAG_TIMECODE 0x00000100 +V4L2_BUF_FLAG_PREPARED 0x00000400 +V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 +V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 +V4L2_BUF_FLAG_LAST 0x00100000 +V4L2_BUF_FLAG_REQUEST_FD 0x00800000 Index: strace-5.1/xlat/v4l2_buf_flags_masks.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_masks.in 2020-01-29 14:19:20.358865958 +0100 @@ -0,0 +1,2 @@ +V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 +V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 Index: strace-5.1/xlat/v4l2_buf_flags_ts_src.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_ts_src.in 2020-01-29 14:19:20.358865958 +0100 @@ -0,0 +1,3 @@ +/* V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 */ +V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 +V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 Index: strace-5.1/xlat/v4l2_buf_flags_ts_type.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_ts_type.in 2020-01-29 14:19:20.358865958 +0100 @@ -0,0 +1,4 @@ +/* V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 */ +V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 +V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 +V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 Index: strace-5.1/xlat/v4l2_buf_flags_masks.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_masks.h 2020-01-29 14:20:25.816233898 +0100 @@ -0,0 +1,40 @@ +/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_masks.in; do not edit. */ + +#include "gcc_compat.h" +#include "static_assert.h" + +#if defined(V4L2_BUF_FLAG_TIMESTAMP_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TIMESTAMP_MASK) == (0x0000e000), "V4L2_BUF_FLAG_TIMESTAMP_MASK != 0x0000e000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 +#endif +#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_MASK) == (0x00070000), "V4L2_BUF_FLAG_TSTAMP_SRC_MASK != 0x00070000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 +#endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_buf_flags_masks[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_buf_flags_masks[] = { + XLAT(V4L2_BUF_FLAG_TIMESTAMP_MASK), + XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_MASK), + XLAT_END +}; + +# endif /* !IN_MPERS */ + +#endif /* !XLAT_MACROS_ONLY */ Index: strace-5.1/xlat/v4l2_buf_flags_ts_src.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_ts_src.h 2020-01-29 14:20:26.039231745 +0100 @@ -0,0 +1,41 @@ +/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_ts_src.in; do not edit. */ + +#include "gcc_compat.h" +#include "static_assert.h" + +#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_EOF) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_EOF) == (0x00000000), "V4L2_BUF_FLAG_TSTAMP_SRC_EOF != 0x00000000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 +#endif +#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_SOE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_SOE) == (0x00010000), "V4L2_BUF_FLAG_TSTAMP_SRC_SOE != 0x00010000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 +#endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_buf_flags_ts_src[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_buf_flags_ts_src[] = { + + XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_EOF), + XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_SOE), + XLAT_END +}; + +# endif /* !IN_MPERS */ + +#endif /* !XLAT_MACROS_ONLY */ Index: strace-5.1/xlat/v4l2_buf_flags_ts_type.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strace-5.1/xlat/v4l2_buf_flags_ts_type.h 2020-01-29 14:20:26.244229766 +0100 @@ -0,0 +1,49 @@ +/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_ts_type.in; do not edit. */ + +#include "gcc_compat.h" +#include "static_assert.h" + +#if defined(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) == (0x00000000), "V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN != 0x00000000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 +#endif +#if defined(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) == (0x00002000), "V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC != 0x00002000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 +#endif +#if defined(V4L2_BUF_FLAG_TIMESTAMP_COPY) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TIMESTAMP_COPY) == (0x00004000), "V4L2_BUF_FLAG_TIMESTAMP_COPY != 0x00004000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 +#endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_buf_flags_ts_type[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_buf_flags_ts_type[] = { + + XLAT(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN), + XLAT(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC), + XLAT(V4L2_BUF_FLAG_TIMESTAMP_COPY), + XLAT_END +}; + +# endif /* !IN_MPERS */ + +#endif /* !XLAT_MACROS_ONLY */ Index: strace-5.1/xlat/v4l2_buf_flags.h =================================================================== --- strace-5.1.orig/xlat/v4l2_buf_flags.h 2019-05-22 15:08:31.000000000 +0200 +++ strace-5.1/xlat/v4l2_buf_flags.h 2020-01-29 14:20:53.627965347 +0100 @@ -3,76 +3,131 @@ #include "gcc_compat.h" #include "static_assert.h" - -#ifndef XLAT_MACROS_ONLY - -# ifdef IN_MPERS - -extern const struct xlat v4l2_buf_flags[]; - -# else - -# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) -static -# endif -const struct xlat v4l2_buf_flags[] = { #if defined(V4L2_BUF_FLAG_MAPPED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_MAPPED) && HAVE_DECL_V4L2_BUF_FLAG_MAPPED) - XLAT(V4L2_BUF_FLAG_MAPPED), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_MAPPED) == (0x00000001), "V4L2_BUF_FLAG_MAPPED != 0x00000001"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_MAPPED 0x00000001 #endif #if defined(V4L2_BUF_FLAG_QUEUED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_QUEUED) && HAVE_DECL_V4L2_BUF_FLAG_QUEUED) - XLAT(V4L2_BUF_FLAG_QUEUED), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_QUEUED) == (0x00000002), "V4L2_BUF_FLAG_QUEUED != 0x00000002"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_QUEUED 0x00000002 #endif #if defined(V4L2_BUF_FLAG_DONE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_DONE) && HAVE_DECL_V4L2_BUF_FLAG_DONE) - XLAT(V4L2_BUF_FLAG_DONE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_DONE) == (0x00000004), "V4L2_BUF_FLAG_DONE != 0x00000004"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_DONE 0x00000004 #endif #if defined(V4L2_BUF_FLAG_KEYFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_KEYFRAME) && HAVE_DECL_V4L2_BUF_FLAG_KEYFRAME) - XLAT(V4L2_BUF_FLAG_KEYFRAME), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_KEYFRAME) == (0x00000008), "V4L2_BUF_FLAG_KEYFRAME != 0x00000008"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_KEYFRAME 0x00000008 #endif #if defined(V4L2_BUF_FLAG_PFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_PFRAME) && HAVE_DECL_V4L2_BUF_FLAG_PFRAME) - XLAT(V4L2_BUF_FLAG_PFRAME), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_PFRAME) == (0x00000010), "V4L2_BUF_FLAG_PFRAME != 0x00000010"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_PFRAME 0x00000010 #endif #if defined(V4L2_BUF_FLAG_BFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_BFRAME) && HAVE_DECL_V4L2_BUF_FLAG_BFRAME) - XLAT(V4L2_BUF_FLAG_BFRAME), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_BFRAME) == (0x00000020), "V4L2_BUF_FLAG_BFRAME != 0x00000020"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_BFRAME 0x00000020 +#endif +#if defined(V4L2_BUF_FLAG_ERROR) || (defined(HAVE_DECL_V4L2_BUF_FLAG_ERROR) && HAVE_DECL_V4L2_BUF_FLAG_ERROR) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_ERROR) == (0x00000040), "V4L2_BUF_FLAG_ERROR != 0x00000040"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_ERROR 0x00000040 +#endif +#if defined(V4L2_BUF_FLAG_IN_REQUEST) || (defined(HAVE_DECL_V4L2_BUF_FLAG_IN_REQUEST) && HAVE_DECL_V4L2_BUF_FLAG_IN_REQUEST) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_IN_REQUEST) == (0x00000080), "V4L2_BUF_FLAG_IN_REQUEST != 0x00000080"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_IN_REQUEST 0x00000080 #endif #if defined(V4L2_BUF_FLAG_TIMECODE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMECODE) && HAVE_DECL_V4L2_BUF_FLAG_TIMECODE) - XLAT(V4L2_BUF_FLAG_TIMECODE), -#endif -#if defined(V4L2_BUF_FLAG_INPUT) || (defined(HAVE_DECL_V4L2_BUF_FLAG_INPUT) && HAVE_DECL_V4L2_BUF_FLAG_INPUT) - XLAT(V4L2_BUF_FLAG_INPUT), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_TIMECODE) == (0x00000100), "V4L2_BUF_FLAG_TIMECODE != 0x00000100"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_TIMECODE 0x00000100 #endif #if defined(V4L2_BUF_FLAG_PREPARED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_PREPARED) && HAVE_DECL_V4L2_BUF_FLAG_PREPARED) - XLAT(V4L2_BUF_FLAG_PREPARED), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_PREPARED) == (0x00000400), "V4L2_BUF_FLAG_PREPARED != 0x00000400"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_PREPARED 0x00000400 #endif #if defined(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) && HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) - XLAT(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) == (0x00000800), "V4L2_BUF_FLAG_NO_CACHE_INVALIDATE != 0x00000800"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 #endif #if defined(V4L2_BUF_FLAG_NO_CACHE_CLEAN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_CLEAN) && HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_CLEAN) - XLAT(V4L2_BUF_FLAG_NO_CACHE_CLEAN), -#endif -#if defined(V4L2_BUF_FLAG_TIMESTAMP_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) - XLAT(V4L2_BUF_FLAG_TIMESTAMP_MASK), -#endif -#if defined(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) - XLAT(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN), -#endif -#if defined(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) - XLAT(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC), -#endif -#if defined(V4L2_BUF_FLAG_TIMESTAMP_COPY) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) - XLAT(V4L2_BUF_FLAG_TIMESTAMP_COPY), -#endif -#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) - XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_MASK), -#endif -#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_EOF) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) - XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_EOF), -#endif -#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_SOE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) - XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_SOE), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_NO_CACHE_CLEAN) == (0x00001000), "V4L2_BUF_FLAG_NO_CACHE_CLEAN != 0x00001000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 #endif #if defined(V4L2_BUF_FLAG_LAST) || (defined(HAVE_DECL_V4L2_BUF_FLAG_LAST) && HAVE_DECL_V4L2_BUF_FLAG_LAST) - XLAT(V4L2_BUF_FLAG_LAST), +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_LAST) == (0x00100000), "V4L2_BUF_FLAG_LAST != 0x00100000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_LAST 0x00100000 +#endif +#if defined(V4L2_BUF_FLAG_REQUEST_FD) || (defined(HAVE_DECL_V4L2_BUF_FLAG_REQUEST_FD) && HAVE_DECL_V4L2_BUF_FLAG_REQUEST_FD) +DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE +static_assert((V4L2_BUF_FLAG_REQUEST_FD) == (0x00800000), "V4L2_BUF_FLAG_REQUEST_FD != 0x00800000"); +DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE +#else +# define V4L2_BUF_FLAG_REQUEST_FD 0x00800000 #endif + +#ifndef XLAT_MACROS_ONLY + +# ifdef IN_MPERS + +extern const struct xlat v4l2_buf_flags[]; + +# else + +# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +static +# endif +const struct xlat v4l2_buf_flags[] = { + XLAT(V4L2_BUF_FLAG_MAPPED), + XLAT(V4L2_BUF_FLAG_QUEUED), + XLAT(V4L2_BUF_FLAG_DONE), + XLAT(V4L2_BUF_FLAG_KEYFRAME), + XLAT(V4L2_BUF_FLAG_PFRAME), + XLAT(V4L2_BUF_FLAG_BFRAME), + XLAT(V4L2_BUF_FLAG_ERROR), + XLAT(V4L2_BUF_FLAG_IN_REQUEST), + XLAT(V4L2_BUF_FLAG_TIMECODE), + XLAT(V4L2_BUF_FLAG_PREPARED), + XLAT(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE), + XLAT(V4L2_BUF_FLAG_NO_CACHE_CLEAN), + XLAT(V4L2_BUF_FLAG_LAST), + XLAT(V4L2_BUF_FLAG_REQUEST_FD), XLAT_END };