Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace struct v4l2_buffer with a reliable alternative definition
Starting with Linux kernel commit v5.6-rc1~93^2~102, the definition of struct v4l2_buffer provided by the kernel depends on the flavour of struct timeval provided by libc. This effectively means that we cannot use the definition provided by the kernel, neither in the decoder nor in tests. * kernel_v4l2_types.h: New file. * Makefile.am (libstrace_a_SOURCES): Add it. * types/v4l2.h (struct_v4l2_buffer): Remove. * v4l2.c: Include "kernel_v4l2_types.h". Replace struct_v4l2_buffer with kernel_v4l2_buffer_t. (VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF): Redefine. (print_v4l2_buffer): Use print_timeval64_data_size to print timestamp field. * linux/32/ioctls_inc_align16.h (VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF): Update. * linux/32/ioctls_inc_align32.h: Likewise. * linux/32/ioctls_inc_align64.h: Likewise. * xlat/v4l2_ioctl_cmds.in (VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF): Comment out. * tests/ioctl_v4l2.c: Include "kernel_v4l2_types.h". (main): Replace struct_v4l2_buffer with kernel_v4l2_buffer_t. (VIDIOC_QUERYBUF, VIDIOC_QBUF, VIDIOC_DQBUF, VIDIOC_PREPARE_BUF): Redefine. * tests/ioctl_v4l2-success.c: Likewise. Resolves: #133
- Loading branch information
Showing
10 changed files
with
111 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org> | ||
* All rights reserved. | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
*/ | ||
|
||
#ifndef STRACE_KERNEL_V4L2_BUFFER_H | ||
# define STRACE_KERNEL_V4L2_BUFFER_H | ||
|
||
# include <stdint.h> | ||
# include <linux/ioctl.h> | ||
# include <linux/types.h> | ||
# include <linux/videodev2.h> | ||
# include "kernel_timeval.h" | ||
|
||
# if defined __sparc__ && defined __arch64__ | ||
typedef struct { | ||
long long tv_sec; | ||
int tv_usec; | ||
int pad; | ||
} kernel_v4l2_timeval_t; | ||
# else | ||
typedef kernel_timeval64_t kernel_v4l2_timeval_t; | ||
# endif | ||
|
||
typedef struct { | ||
uint32_t index; | ||
uint32_t type; | ||
uint32_t bytesused; | ||
uint32_t flags; | ||
uint32_t field; | ||
kernel_v4l2_timeval_t timestamp; | ||
struct v4l2_timecode timecode; | ||
uint32_t sequence; | ||
uint32_t memory; | ||
union { | ||
uint32_t offset; | ||
unsigned long userptr; | ||
struct v4l2_plane *planes; | ||
int32_t fd; | ||
} m; | ||
uint32_t length; | ||
uint32_t reserved2; | ||
union { | ||
int32_t request_fd; | ||
uint32_t reserved; | ||
}; | ||
} kernel_v4l2_buffer_t; | ||
|
||
#endif /* !STRACE_KERNEL_V4L2_BUFFER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters