Re: [PATCH v4l-utils] Add missing linux/bpf_common.h

2018-11-09 Thread Peter Seiderer
Hello Sean,

On Fri, 9 Nov 2018 12:10:38 +, Sean Young  wrote:

> Hi Peter,
> 
> On Thu, Nov 08, 2018 at 10:13:38PM +0100, Peter Seiderer wrote:
> > Thanks, works for the buildroot use case (disabling
> > bpf support unconditionally)...
> > 
> > The reason to provide copies of the linux kernel headers in  v4l-utils
> > is to be independent of old(-er) headers provided by toolchains?
> > 
> > If so a copy of bpf_common.h is still needed (and the fallback, for
> > out of linux kernel usage, define for __NR_bpf in bpf.h enhanced for
> > all supported archs)?  
> 
> I have seen this problem on debian 7. Why do we care about compiling
> on something that ancient?

It is not about compiling on what system, it is about which toolchain 
is used (for cross-compile), and the initial failure comes from
the buildroot [1] embedded system autobuild tests...

Personally I do not care about these toolchains (but the buildroot
people think it is worth to do automatic build tests with them) and
can live with the disabling of the bpf support

Regards,
Peter
 
[1] https://buildroot.org/

> 
> 
> Sean



Re: [PATCH v4l-utils] Add missing linux/bpf_common.h

2018-11-08 Thread Peter Seiderer
Hello Sean,

On Wed, 7 Nov 2018 12:05:45 +, Sean Young  wrote:

> Hi Peter,
> 
> On Tue, Nov 06, 2018 at 10:43:58PM +0100, Peter Seiderer wrote:
> > On Tue, 6 Nov 2018 10:38:56 +, Sean Young  wrote:
> >   
> > > On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote:  
> > > > Copy from [1], needed by bpf.h.
> > > >
> > > > [1] 
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19
> > > >   
> > >
> > > So bpf.h does include this file, but we don't use anything from it in
> > > v4l-utils.
> > >  
> > 
> > Maybe alternative fix is to remove the include (or not if your want
> > the headers to be in sync with the kernel ones, but then they should
> > be complete enough to be used for compile)?
> >   
> > > This include file is for the original BPF, which has been around for a
> > > long time. So why is this include file missing, i.e. what problem are you
> > > trying to solve?  
> > 
> > A buildroot autobuild failure (see [1] for details) with older toolchains
> > not providing this header...
> >   
> > >
> > > Lastely, the file should be included in the sync-with-kernel target so
> > > it does not get out of sync -- should it really be necessary to add the
> > > file.  
> > 
> > O.k, can do it on next patch iteration...
> > 
> > Regards,
> > Peter
> > 
> > [1] http://lists.busybox.net/pipermail/buildroot/2018-November/234840.html  
> 
> So here libelf was not detected, hence ir-keytable should have been built
> without BPF support, but it is still including bpf.h despite it not
> being used.
> 
> I've just sent a patch for better support for building without BPF,
> see here:
>   https://patchwork.linuxtv.org/patch/52841/
> 
> 
> Would you mind seeing if that works for you?

Thanks, works for the buildroot use case (disabling
bpf support unconditionally)...

The reason to provide copies of the linux kernel headers in  v4l-utils
is to be independent of old(-er) headers provided by toolchains?

If so a copy of bpf_common.h is still needed (and the fallback, for
out of linux kernel usage, define for __NR_bpf in bpf.h enhanced for
all supported archs)?

Regards,
Peter

> 
> 
> Thanks,
> 
> Sean



Re: [PATCH v2 v4l-utils] configure: build without BPF support in ir-keytable

2018-11-08 Thread Peter Seiderer
Hello Sean,

On Wed,  7 Nov 2018 12:02:05 +, Sean Young  wrote:

> It currently does not build on mips and some platforms do not have
> BPF support yet (risc-v, for example).
> 

Thanks for the patch, works for the buildroot use case (disabling
bpf support unconditionally), see [1]...

Regards,
Peter

[1] http://lists.busybox.net/pipermail/buildroot/2018-November/235268.html

> Signed-off-by: Sean Young 
> ---
>  configure.ac   | 17 +
>  utils/keytable/Makefile.am |  7 ---
>  utils/keytable/keytable.c  |  5 -
>  3 files changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 387f8539..5cc34c24 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -173,16 +173,12 @@ AM_CONDITIONAL([HAVE_X11], [test x$x11_pkgconfig = 
> xyes])
>  PKG_CHECK_MODULES([LIBELF], [libelf], [libelf_pkgconfig=yes], 
> [libelf_pkgconfig=no])
>  AC_SUBST([LIBELF_CFLAGS])
>  AC_SUBST([LIBELF_LIBS])
> -AM_CONDITIONAL([HAVE_LIBELF], [test x$libelf_pkgconfig = xyes])
>  if test "x$libelf_pkgconfig" = "xyes"; then
>AC_CHECK_PROG([CLANG], clang, clang)
> -  AC_DEFINE([HAVE_LIBELF], [1], [libelf library is present])
>  else
>AC_MSG_WARN(libelf library not available)
>  fi
>  
> -AM_CONDITIONAL([BPF_PROTOCOLS], [test x$CLANG = xclang])
> -
>  AS_IF([test "x$x11_pkgconfig" = xyes],
>[PKG_CHECK_MODULES(GL, [gl], [gl_pkgconfig=yes], [gl_pkgconfig=no])], 
> [gl_pkgconfig=no])
>  AC_SUBST([GL_CFLAGS])
> @@ -453,6 +449,14 @@ AC_ARG_ENABLE(gconv,
> esac]
>  )
>  
> +AC_ARG_ENABLE(bpf,
> +  AS_HELP_STRING([--disable-bpf], [disable IR BPF decoders]),
> +  [case "${enableval}" in
> +yes | no ) ;;
> +*) AC_MSG_ERROR(bad value ${enableval} for --enable-bpf) ;;
> +   esac]
> +)
> +
>  PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image], [sdl_pc=yes], [sdl_pc=no])
>  AM_CONDITIONAL([HAVE_SDL], [test x$sdl_pc = xyes])
>  
> @@ -475,6 +479,7 @@ AM_CONDITIONAL([WITH_GCONV],[test x$enable_gconv 
> = xyes -a x$enable_shar
>  AM_CONDITIONAL([WITH_V4L2_CTL_LIBV4L], [test x${enable_v4l2_ctl_libv4l} != 
> xno])
>  AM_CONDITIONAL([WITH_V4L2_CTL_STREAM_TO], [test 
> x${enable_v4l2_ctl_stream_to} != xno])
>  AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test 
> x${enable_v4l2_compliance_libv4l} != xno])
> +AM_CONDITIONAL([WITH_BPF],  [test x$enable_bpf != xno -a 
> x$libelf_pkgconfig = xyes -a x$CLANG = xclang])
>  
>  # append -static to libtool compile and link command to enforce static libs
>  AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], 
> ["-static"])])
> @@ -505,6 +510,9 @@ AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], 
> [USE_V4L_WRAPPERS="no"
>  AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"])
>  AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], 
> [USE_V4L2_CTL_LIBV4L="no"])
>  AM_COND_IF([WITH_V4L2_COMPLIANCE_LIBV4L], 
> [USE_V4L2_COMPLIANCE_LIBV4L="yes"], [USE_V4L2_COMPLIANCE_LIBV4L="no"])
> +AM_COND_IF([WITH_BPF], [USE_BPF="yes"
> +AC_DEFINE([HAVE_BPF], [1], [BPF IR decoder 
> support enabled])],
> + [USE_BPF="no"])
>  AS_IF([test "x$alsa_pkgconfig" = "xtrue"], [USE_ALSA="yes"], [USE_ALSA="no"])
>  bpf.h
>  AC_OUTPUT
> @@ -549,4 +557,5 @@ compile time options summary
>  qvidcap: $USE_QVIDCAP
>  v4l2-ctl uses libv4l   : $USE_V4L2_CTL_LIBV4L
>  v4l2-compliance uses libv4l: $USE_V4L2_COMPLIANCE_LIBV4L
> +BPF IR Decoders:   : $USE_BPF
>  EOF
> diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am
> index 90e4c8c8..ddbab0f7 100644
> --- a/utils/keytable/Makefile.am
> +++ b/utils/keytable/Makefile.am
> @@ -6,14 +6,15 @@ udevrules_DATA = 70-infrared.rules
>  
>  ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c 
> toml.h
>  
> -if HAVE_LIBELF
> +if WITH_BPF
>  ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h
>  endif
>  
>  ir_keytable_LDADD = @LIBINTL@
> -ir_keytable_LDFLAGS = $(ARGP_LIBS) $(LIBELF_LIBS)
> +ir_keytable_LDFLAGS = $(ARGP_LIBS)
>  
> -if BPF_PROTOCOLS
> +if WITH_BPF
> +ir_keytable_LDFLAGS += $(LIBELF_LIBS)
>  SUBDIRS = bpf_protocols
>  endif
>  
> diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
> index a7ed436b..6fc22358 100644
> --- a/utils/keytable/keytable.c
> +++ b/utils/keytable/keytable.c
> @@ -34,8 +34,11 @@
>  #include "ir-encode.h"
>  #include "parse.h"
>  #include "toml.h"
> +
> +#ifdef HAVE_BPF
>  #include "bpf.h"
>  #include "bpf_load.h"
> +#endif
>  
>  #ifdef ENABLE_NLS
>  # define _(string) gettext(string)
> @@ -1847,7 +1850,7 @@ static void device_info(int fd, char *prepend)
>   perror ("EVIOCGID");
>  }
>  
> -#ifdef HAVE_LIBELF
> +#ifdef HAVE_BPF
>  #define MAX_PROGS 64
>  static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct 
> toml_table_t *toml)
>  {



[PATCH v4l-utils] Add missing linux/bpf_common.h

2018-11-06 Thread Peter Seiderer
File needed by linux/bpf.h, add copy from linux-4.19.1 (and add
to sync-with-kernel Makefile target).

Signed-off-by: Peter Seiderer 
---
Changes v1 -> v2:
  - add linux/bpf_common.h to sync-with-kernel target
---
 Makefile.am|  4 ++-
 include/linux/bpf_common.h | 57 ++
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/bpf_common.h

diff --git a/Makefile.am b/Makefile.am
index 52f8e4c2..b0b8a098 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,8 @@ sync-with-kernel:
  ! -f $(KERNEL_DIR)/usr/include/linux/dvb/frontend.h -o \
  ! -f $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h -o \
  ! -f $(KERNEL_DIR)/usr/include/linux/lirc.h -o \
- ! -f $(KERNEL_DIR)/usr/include/linux/bpf.h ]; then \
+ ! -f $(KERNEL_DIR)/usr/include/linux/bpf.h -o \
+ ! -f $(KERNEL_DIR)/usr/include/linux/bpf_common.h ]; then \
  echo "Error you must set KERNEL_DIR to point to an extracted kernel 
source dir"; \
  echo "and run 'make headers_install' in \$$KERNEL_DIR."; \
  exit 1; \
@@ -45,6 +46,7 @@ sync-with-kernel:
cp -a $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h 
$(top_srcdir)/include/linux/dvb
cp -a $(KERNEL_DIR)/usr/include/linux/lirc.h $(top_srcdir)/include/linux
cp -a $(KERNEL_DIR)/usr/include/linux/bpf.h $(top_srcdir)/include/linux
+   cp -a $(KERNEL_DIR)/usr/include/linux/bpf_common.h 
$(top_srcdir)/include/linux
cp -a $(KERNEL_DIR)/usr/include/linux/cec.h $(top_srcdir)/include/linux
cp -a $(KERNEL_DIR)/usr/include/linux/cec-funcs.h 
$(top_srcdir)/include/linux
cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 
$(top_srcdir)/utils/common
diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h
new file mode 100644
index ..f0fe1394
--- /dev/null
+++ b/include/linux/bpf_common.h
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __LINUX_BPF_COMMON_H__
+#define __LINUX_BPF_COMMON_H__
+
+/* Instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#defineBPF_LD  0x00
+#defineBPF_LDX 0x01
+#defineBPF_ST  0x02
+#defineBPF_STX 0x03
+#defineBPF_ALU 0x04
+#defineBPF_JMP 0x05
+#defineBPF_RET 0x06
+#defineBPF_MISC0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code)  ((code) & 0x18)
+#defineBPF_W   0x00 /* 32-bit */
+#defineBPF_H   0x08 /* 16-bit */
+#defineBPF_B   0x10 /*  8-bit */
+/* eBPFBPF_DW  0x1864-bit */
+#define BPF_MODE(code)  ((code) & 0xe0)
+#defineBPF_IMM 0x00
+#defineBPF_ABS 0x20
+#defineBPF_IND 0x40
+#defineBPF_MEM 0x60
+#defineBPF_LEN 0x80
+#defineBPF_MSH 0xa0
+
+/* alu/jmp fields */
+#define BPF_OP(code)((code) & 0xf0)
+#defineBPF_ADD 0x00
+#defineBPF_SUB 0x10
+#defineBPF_MUL 0x20
+#defineBPF_DIV 0x30
+#defineBPF_OR  0x40
+#defineBPF_AND 0x50
+#defineBPF_LSH 0x60
+#defineBPF_RSH 0x70
+#defineBPF_NEG 0x80
+#defineBPF_MOD 0x90
+#defineBPF_XOR 0xa0
+
+#defineBPF_JA  0x00
+#defineBPF_JEQ 0x10
+#defineBPF_JGT 0x20
+#defineBPF_JGE 0x30
+#defineBPF_JSET0x40
+#define BPF_SRC(code)   ((code) & 0x08)
+#defineBPF_K   0x00
+#defineBPF_X   0x08
+
+#ifndef BPF_MAXINSNS
+#define BPF_MAXINSNS 4096
+#endif
+
+#endif /* __LINUX_BPF_COMMON_H__ */
--
2.19.1



Re: [PATCH v4l-utils] Add missing linux/bpf_common.h

2018-11-06 Thread Peter Seiderer
Hello Sean,

On Tue, 6 Nov 2018 10:38:56 +, Sean Young  wrote:

> On Mon, Nov 05, 2018 at 09:30:47PM +0100, Peter Seiderer wrote:
> > Copy from [1], needed by bpf.h.
> >
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19
>
> So bpf.h does include this file, but we don't use anything from it in
> v4l-utils.
>

Maybe alternative fix is to remove the include (or not if your want
the headers to be in sync with the kernel ones, but then they should
be complete enough to be used for compile)?

> This include file is for the original BPF, which has been around for a
> long time. So why is this include file missing, i.e. what problem are you
> trying to solve?

A buildroot autobuild failure (see [1] for details) with older toolchains
not providing this header...

>
> Lastely, the file should be included in the sync-with-kernel target so
> it does not get out of sync -- should it really be necessary to add the
> file.

O.k, can do it on next patch iteration...

Regards,
Peter

[1] http://lists.busybox.net/pipermail/buildroot/2018-November/234840.html

>
>
> Sean
>
> >
> > Signed-off-by: Peter Seiderer 
> > ---
> >  include/linux/bpf_common.h | 57 ++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644 include/linux/bpf_common.h
> >
> > diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h
> > new file mode 100644
> > index ..ee97668b
> > --- /dev/null
> > +++ b/include/linux/bpf_common.h
> > @@ -0,0 +1,57 @@
> > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> > +#ifndef _UAPI__LINUX_BPF_COMMON_H__
> > +#define _UAPI__LINUX_BPF_COMMON_H__
> > +
> > +/* Instruction classes */
> > +#define BPF_CLASS(code) ((code) & 0x07)
> > +#defineBPF_LD  0x00
> > +#defineBPF_LDX 0x01
> > +#defineBPF_ST  0x02
> > +#defineBPF_STX 0x03
> > +#defineBPF_ALU 0x04
> > +#defineBPF_JMP 0x05
> > +#defineBPF_RET 0x06
> > +#defineBPF_MISC0x07
> > +
> > +/* ld/ldx fields */
> > +#define BPF_SIZE(code)  ((code) & 0x18)
> > +#defineBPF_W   0x00 /* 32-bit */
> > +#defineBPF_H   0x08 /* 16-bit */
> > +#defineBPF_B   0x10 /*  8-bit */
> > +/* eBPFBPF_DW  0x1864-bit */
> > +#define BPF_MODE(code)  ((code) & 0xe0)
> > +#defineBPF_IMM 0x00
> > +#defineBPF_ABS 0x20
> > +#defineBPF_IND 0x40
> > +#defineBPF_MEM 0x60
> > +#defineBPF_LEN 0x80
> > +#defineBPF_MSH 0xa0
> > +
> > +/* alu/jmp fields */
> > +#define BPF_OP(code)((code) & 0xf0)
> > +#defineBPF_ADD 0x00
> > +#defineBPF_SUB 0x10
> > +#defineBPF_MUL 0x20
> > +#defineBPF_DIV 0x30
> > +#defineBPF_OR  0x40
> > +#defineBPF_AND 0x50
> > +#defineBPF_LSH 0x60
> > +#defineBPF_RSH 0x70
> > +#defineBPF_NEG 0x80
> > +#defineBPF_MOD 0x90
> > +#defineBPF_XOR 0xa0
> > +
> > +#defineBPF_JA  0x00
> > +#defineBPF_JEQ 0x10
> > +#defineBPF_JGT 0x20
> > +#defineBPF_JGE 0x30
> > +#defineBPF_JSET0x40
> > +#define BPF_SRC(code)   ((code) & 0x08)
> > +#defineBPF_K   0x00
> > +#defineBPF_X   0x08
> > +
> > +#ifndef BPF_MAXINSNS
> > +#define BPF_MAXINSNS 4096
> > +#endif
> > +
> > +#endif /* _UAPI__LINUX_BPF_COMMON_H__ */
> > --
> > 2.19.1



[PATCH v4l-utils] Add missing linux/bpf_common.h

2018-11-05 Thread Peter Seiderer
Copy from [1], needed by bpf.h.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf_common.h?h=v4.19

Signed-off-by: Peter Seiderer 
---
 include/linux/bpf_common.h | 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 include/linux/bpf_common.h

diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h
new file mode 100644
index ..ee97668b
--- /dev/null
+++ b/include/linux/bpf_common.h
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI__LINUX_BPF_COMMON_H__
+#define _UAPI__LINUX_BPF_COMMON_H__
+
+/* Instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#defineBPF_LD  0x00
+#defineBPF_LDX 0x01
+#defineBPF_ST  0x02
+#defineBPF_STX 0x03
+#defineBPF_ALU 0x04
+#defineBPF_JMP 0x05
+#defineBPF_RET 0x06
+#defineBPF_MISC0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code)  ((code) & 0x18)
+#defineBPF_W   0x00 /* 32-bit */
+#defineBPF_H   0x08 /* 16-bit */
+#defineBPF_B   0x10 /*  8-bit */
+/* eBPFBPF_DW  0x1864-bit */
+#define BPF_MODE(code)  ((code) & 0xe0)
+#defineBPF_IMM 0x00
+#defineBPF_ABS 0x20
+#defineBPF_IND 0x40
+#defineBPF_MEM 0x60
+#defineBPF_LEN 0x80
+#defineBPF_MSH 0xa0
+
+/* alu/jmp fields */
+#define BPF_OP(code)((code) & 0xf0)
+#defineBPF_ADD 0x00
+#defineBPF_SUB 0x10
+#defineBPF_MUL 0x20
+#defineBPF_DIV 0x30
+#defineBPF_OR  0x40
+#defineBPF_AND 0x50
+#defineBPF_LSH 0x60
+#defineBPF_RSH 0x70
+#defineBPF_NEG 0x80
+#defineBPF_MOD 0x90
+#defineBPF_XOR 0xa0
+
+#defineBPF_JA  0x00
+#defineBPF_JEQ 0x10
+#defineBPF_JGT 0x20
+#defineBPF_JGE 0x30
+#defineBPF_JSET0x40
+#define BPF_SRC(code)   ((code) & 0x08)
+#defineBPF_K   0x00
+#defineBPF_X   0x08
+
+#ifndef BPF_MAXINSNS
+#define BPF_MAXINSNS 4096
+#endif
+
+#endif /* _UAPI__LINUX_BPF_COMMON_H__ */
-- 
2.19.1



[PATCH v4 2/2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-15 Thread Peter Seiderer
- enables gstreamer v4l2src lost frame detection, e.g:

  0:00:08.685185668  348  0x54f520 WARN  v4l2src 
gstv4l2src.c:970:gst_v4l2src_create: lost frames detected: count = 
141 - ts: 0:00:08.330177332

- fixes v4l2-compliance test failure:

  Streaming ioctls:
  test read/write: OK (Not Supported)
  Video Capture:
  Buffer: 0 Sequence: 0 Field: None Timestamp: 92.991450s
  Buffer: 1 Sequence: 0 Field: None Timestamp: 93.008135s
  fail: v4l2-test-buffers.cpp(294): (int)g_sequence() < 
seq.last_seq + 1
  fail: v4l2-test-buffers.cpp(707): buf.check(q, last_seq)

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
Changes in v2:
  - fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too
(suggested by Steve Longerbeam)

Changes in v3:
  - add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam
and Dan Carpenter) and patch history
  - use u32 (instead of __u32) (suggested by Dan Carpenter)
  - let sequence counter start with zero, keeping v4l2-compliance
testing happy (needs additional setting of field to a valid
value, patch will follow soon)

Changes in v4:
  - add v4l2-compliance test failure to changelog
  - reorder frame_sequence increment and assignement to
avoid -1 as start value (suggeted by Steve Longerbeam)
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 4 
 drivers/staging/media/imx/imx-media-csi.c   | 4 
 2 files changed, 8 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ffeb017c73b2..28f41caba05d 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -103,6 +103,7 @@ struct prp_priv {
int nfb4eof_irq;
 
int stream_count;
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;  /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -211,12 +212,14 @@ static void prp_vb2_buf_done(struct prp_priv *priv, 
struct ipuv3_channel *ch)
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
done->vbuf.field = vdev->fmt.fmt.pix.field;
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
}
 
+   priv->frame_sequence++;
priv->nfb4eof = false;
 
/* get next queued buffer */
@@ -638,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5f69117b5811..3f2ce05848f3 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -237,12 +238,14 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
done->vbuf.field = vdev->fmt.fmt.pix.field;
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
}
 
+   priv->frame_sequence++;
priv->nfb4eof = false;
 
/* get next queued buffer */
@@ -544,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2



[PATCH v4 1/2] media: staging/imx: fill vb2_v4l2_buffer field entry

2018-03-15 Thread Peter Seiderer
- fixes gstreamer v4l2src warning:

  0:00:00.716640334  349  0x164f720 WARN  v4l2bufferpool 
gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf: Driver 
should never set v4l2_buffer.field to ANY

- fixes v4l2-compliance test failure:

  Streaming ioctls:
  test read/write: OK (Not Supported)
  Video Capture:
  Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
  fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
Changes in v4:
  - new patch (put first because patch is needed to advance with
the v4l2-compliance test), thanks to Philipp Zabel
<p.za...@pengutronix.de> for suggested solution for the right
field value source
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 1 +
 drivers/staging/media/imx/imx-media-csi.c   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ae453fd422f0..ffeb017c73b2 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -210,6 +210,7 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct 
ipuv3_channel *ch)
 
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.field = vdev->fmt.fmt.pix.field;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..5f69117b5811 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -236,6 +236,7 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
 
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.field = vdev->fmt.fmt.pix.field;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
-- 
2.16.2



[PATCH v3] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-14 Thread Peter Seiderer
Enables gstreamer v4l2src lost frame detection, e.g:

  0:00:08.685185668  348  0x54f520 WARN  v4l2src 
gstv4l2src.c:970:gst_v4l2src_create: lost frames detected: count = 
141 - ts: 0:00:08.330177332

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
Changes in v2:
  - fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too
(suggested by Steve Longerbeam)

Changes in v3:
  - add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam
and Dan Carpenter) and patch history
  - use u32 (instead of __u32) (suggested by Dan Carpenter)
  - let sequence counter start with zero, keeping v4l2-compliance
testing happy (needs additional setting of field to a valid
value, patch will follow soon)
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 5 +
 drivers/staging/media/imx/imx-media-csi.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ae453fd422f0..274683d2d4ba 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -103,6 +103,7 @@ struct prp_priv {
int nfb4eof_irq;
 
int stream_count;
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;  /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -208,8 +209,11 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct 
ipuv3_channel *ch)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -637,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
 
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..161a92946a86 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2



[PATCH v2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Peter Seiderer
Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 5 +
 drivers/staging/media/imx/imx-media-csi.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ae453fd422f0..eaca74b72114 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -103,6 +103,7 @@ struct prp_priv {
int nfb4eof_irq;
 
int stream_count;
+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;  /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -208,8 +209,11 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct 
ipuv3_channel *ch)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -637,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..3a6a645b9dce 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2



Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Peter Seiderer
Hello Steve,

On Tue, 13 Mar 2018 15:03:07 -0700, Steve Longerbeam <slongerb...@gmail.com> 
wrote:

> Hi Peter,
> 
> Thanks for the patch.
> 
> This needs to be done in imx-ic-prpencvf.c as well, see
> prp_vb2_buf_done().

Ahh, I see, would you prefer an follow up patch or
an v2 patch doing the changes on mx-media-csi.c and
imx-ic-prpencvf.c at once?

Regards,
Peter

> 
> Steve
> 
> 
> On 03/13/2018 01:00 PM, Peter Seiderer wrote:
> > Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
> > ---
> >   drivers/staging/media/imx/imx-media-csi.c | 5 +
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/staging/media/imx/imx-media-csi.c 
> > b/drivers/staging/media/imx/imx-media-csi.c
> > index 5a195f80a24d..3a6a645b9dce 100644
> > --- a/drivers/staging/media/imx/imx-media-csi.c
> > +++ b/drivers/staging/media/imx/imx-media-csi.c
> > @@ -111,6 +111,7 @@ struct csi_priv {
> > struct v4l2_ctrl_handler ctrl_hdlr;
> >   
> > int stream_count; /* streaming counter */
> > +   __u32 frame_sequence; /* frame sequence counter */
> > bool last_eof;   /* waiting for last EOF at stream off */
> > bool nfb4eof;/* NFB4EOF encountered during streaming */
> > struct completion last_eof_comp;
> > @@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
> > struct vb2_buffer *vb;
> > dma_addr_t phys;
> >   
> > +   priv->frame_sequence++;
> > +
> > done = priv->active_vb2_buf[priv->ipu_buf_num];
> > if (done) {
> > +   done->vbuf.sequence = priv->frame_sequence;
> > vb = >vbuf.vb2_buf;
> > vb->timestamp = ktime_get_ns();
> > vb2_buffer_done(vb, priv->nfb4eof ?
> > @@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
> >   
> > /* init EOF completion waitq */
> > init_completion(>last_eof_comp);
> > +   priv->frame_sequence = 0;
> > priv->last_eof = false;
> > priv->nfb4eof = false;
> > 
> 



[PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-13 Thread Peter Seiderer
Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 drivers/staging/media/imx/imx-media-csi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..3a6a645b9dce 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   __u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = 0;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2



[PATCH v1] libdvbv5: add optional copy of TEMP_FAILURE_RETRY macro (fix musl compile)

2018-03-04 Thread Peter Seiderer
Fixes:

  ../../lib/libdvbv5/.libs/libdvbv5.so: undefined reference to 
`TEMP_FAILURE_RETRY'

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 lib/libdvbv5/dvb-dev-local.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/libdvbv5/dvb-dev-local.c b/lib/libdvbv5/dvb-dev-local.c
index 8bc99d1..7a76d65 100644
--- a/lib/libdvbv5/dvb-dev-local.c
+++ b/lib/libdvbv5/dvb-dev-local.c
@@ -44,6 +44,15 @@
 # define _(string) string
 #endif
 
+/* taken from glibc unistd.h */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+({ long int __result; \
+   do __result = (long int) (expression); \
+   while (__result == -1L && errno == EINTR); \
+   __result; })
+#endif
+
 struct dvb_dev_local_priv {
dvb_dev_change_t notify_dev_change;
 
-- 
2.16.2



[PATCH] keytable: fix EVIOCSCLOCKID related compile failure

2018-02-06 Thread Peter Seiderer
Fixes:

  keytable.c: In function 'test_event':
  keytable.c:1351:12: error: 'EVIOCSCLOCKID' undeclared (first use in this 
function)
ioctl(fd, EVIOCSCLOCKID, );
  ^

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 utils/keytable/keytable.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 34a1522e..925eab00 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -55,6 +55,10 @@ struct input_keymap_entry_v2 {
u_int8_t  scancode[32];
 };
 
+#ifndef EVIOCSCLOCKID
+#define EVIOCSCLOCKID  _IOW('E', 0xa0, int)
+#endif
+
 #ifndef EVIOCGKEYCODE_V2
 #define EVIOCGKEYCODE_V2   _IOR('E', 0x04, struct input_keymap_entry_v2)
 #define EVIOCSKEYCODE_V2   _IOW('E', 0x04, struct input_keymap_entry_v2)
-- 
2.16.1




[PATCH v1] qv4l2: fix qv4l2.pro qmake project file

2017-03-04 Thread Peter Seiderer
The header files v4l2-tpg.h and v4l2-tpg-colors.h moved
from v4l2-ctl to common.

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 utils/qv4l2/qv4l2.pro | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro
index 02b03dea..6420fa24 100644
--- a/utils/qv4l2/qv4l2.pro
+++ b/utils/qv4l2/qv4l2.pro
@@ -13,6 +13,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 QT += opengl
 
 INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../common
 INCLUDEPATH += $$PWD/../v4l2-ctl/
 INCLUDEPATH += $$PWD/../v4l2-compliance
 
@@ -25,8 +26,8 @@ HEADERS += general-tab.h
 HEADERS += qv4l2.h
 HEADERS += raw2sliced.h
 HEADERS += vbi-tab.h
-HEADERS += ../v4l2-ctl/v4l2-tpg.h
-HEADERS += ../v4l2-ctl/v4l2-tpg-colors.h
+HEADERS += ../common/v4l2-tpg.h
+HEADERS += ../common/v4l2-tpg-colors.h
 HEADERS += ../../config.h
 
 SOURCES += capture-win.cpp
-- 
2.11.0



[PATCH v1 1/2] ir-ctl: use strndup instead of strndupa (fixes musl compile)

2017-02-20 Thread Peter Seiderer
Fixes buildroot musl compile (see [1], [2]):

  ir-ctl.c:(.text+0xb06): undefined reference to `strndupa'

[1] 
http://autobuild.buildroot.net/results/b8b96c7bbf2147dacac62485cbfdbcfd758271a5
[2] http://lists.busybox.net/pipermail/buildroot/2017-February/184048.html

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 utils/ir-ctl/ir-ctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index bc58cee0..f938b429 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -344,12 +344,14 @@ static struct file *read_scancode(const char *name)
return NULL;
}
 
-   pstr = strndupa(name, p - name);
+   pstr = strndup(name, p - name);
 
if (!protocol_match(pstr, )) {
fprintf(stderr, _("error: protocol '%s' not found\n"), pstr);
+   free(pstr);
return NULL;
}
+   free(pstr);
 
if (!strtoscancode(p + 1, )) {
fprintf(stderr, _("error: invalid scancode '%s'\n"), p + 1);
-- 
2.11.0



[PATCH v1 2/2] ir-ctl: add optional copy of TEMP_FAILURE_RETRY macro (fix musl compile)

2017-02-20 Thread Peter Seiderer
Fixes buildroot musl compile (see [1], [2]):

  ir-ctl.c:(.text+0xe01): undefined reference to `TEMP_FAILURE_RETRY'

[1] 
http://autobuild.buildroot.net/results/b8b96c7bbf2147dacac62485cbfdbcfd758271a5
[2] http://lists.busybox.net/pipermail/buildroot/2017-February/184048.html

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 utils/ir-ctl/ir-ctl.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index f938b429..e9da7778 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -44,6 +44,15 @@
 
 # define N_(string) string
 
+/* taken from glibc unistd.h */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__  \
+({ long int __result; \
+   do __result = (long int) (expression); \
+   while (__result == -1L && errno == EINTR); \
+   __result; }))
+#endif
 
 /* See drivers/media/rc/ir-lirc-codec.c line 23 */
 #define LIRCBUF_SIZE   512
-- 
2.11.0



[PATCH v1] dvb/keytable: fix libintl linking

2015-10-16 Thread Peter Seiderer
Fix libintl linking for uclibc (see [1] for details).

[1] http://lists.busybox.net/pipermail/buildroot/2015-October/142032.html

Signed-off-by: Peter Seiderer <ps.rep...@gmx.net>
---
 utils/dvb/Makefile.am  | 8 
 utils/keytable/Makefile.am | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/utils/dvb/Makefile.am b/utils/dvb/Makefile.am
index 6aae408..a96a1a2 100644
--- a/utils/dvb/Makefile.am
+++ b/utils/dvb/Makefile.am
@@ -2,19 +2,19 @@ bin_PROGRAMS = dvb-fe-tool dvbv5-zap dvbv5-scan 
dvb-format-convert
 man_MANS = dvb-fe-tool.1 dvbv5-zap.1 dvbv5-scan.1 dvb-format-convert.1
 
 dvb_fe_tool_SOURCES = dvb-fe-tool.c
-dvb_fe_tool_LDADD = ../../lib/libdvbv5/libdvbv5.la
+dvb_fe_tool_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@
 dvb_fe_tool_LDFLAGS = $(ARGP_LIBS) -lm
 
 dvbv5_zap_SOURCES = dvbv5-zap.c
-dvbv5_zap_LDADD = ../../lib/libdvbv5/libdvbv5.la
+dvbv5_zap_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@
 dvbv5_zap_LDFLAGS = $(ARGP_LIBS) -lm
 
 dvbv5_scan_SOURCES = dvbv5-scan.c
-dvbv5_scan_LDADD = ../../lib/libdvbv5/libdvbv5.la
+dvbv5_scan_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@
 dvbv5_scan_LDFLAGS = $(ARGP_LIBS) -lm
 
 dvb_format_convert_SOURCES = dvb-format-convert.c
-dvb_format_convert_LDADD = ../../lib/libdvbv5/libdvbv5.la
+dvb_format_convert_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@
 dvb_format_convert_LDFLAGS = $(ARGP_LIBS) -lm
 
 EXTRA_DIST = README
diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am
index 925c8ea..8444ac2 100644
--- a/utils/keytable/Makefile.am
+++ b/utils/keytable/Makefile.am
@@ -5,6 +5,7 @@ keytablesystem_DATA = $(srcdir)/rc_keymaps/*
 udevrules_DATA = 70-infrared.rules
 
 ir_keytable_SOURCES = keytable.c parse.h
+ir_keytable_LDADD = @LIBINTL@
 ir_keytable_LDFLAGS = $(ARGP_LIBS)
 
 EXTRA_DIST = 70-infrared.rules rc_keymaps rc_keymaps_userspace 
gen_keytables.pl ir-keytable.1 rc_maps.cfg
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] qv4l2: enable qt5 opengl build

2014-12-15 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 configure.ac  | 12 ++--
 utils/qv4l2/qv4l2.pro |  7 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 588dd9e..dce2848 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,8 +143,16 @@ if test x$qt_pkgconfig = xtrue; then
AC_SUBST(MOC)
AC_SUBST(UIC)
AC_SUBST(RCC)
-# disable QTGL for qt5 because qv4l2 crash
-   qt_pkgconfig_gl=false
+   PKG_CHECK_MODULES(QT5GL, [Qt5OpenGL = 5.0 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
+   if test x$qt_pkgconfig_gl = xtrue; then
+  QTGL_CFLAGS=$QT5GL_CFLAGS -fPIC
+  QTGL_LIBS=$QT5GL_LIBS
+  AC_SUBST(QT_CFLAGS)
+  AC_SUBST(QT_LIBS)
+  AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
+   else
+  AC_MSG_WARN(Qt5 OpenGL is not available)
+fi
 else
PKG_CHECK_MODULES(QT, [QtCore = 4.0 QtGui = 4.0], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
if test x$qt_pkgconfig = xtrue; then
diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro
index 82500af..a2106d0 100644
--- a/utils/qv4l2/qv4l2.pro
+++ b/utils/qv4l2/qv4l2.pro
@@ -8,12 +8,9 @@ CONFIG += debug
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
-#
-# qt5: opengl support for disabled (will crash on startup)
-#
-# qt4: to disable opengl suppport comment out the following
+# opengl: to disable opengl suppport comment out the following
 # line and the line '#define HAVE_QTGL 1' from ../../config.h
-lessThan(QT_MAJOR_VERSION, 5): QT += opengl
+QT += opengl
 
 INCLUDEPATH += $$PWD/../..
 INCLUDEPATH += $$PWD/../v4l2-ctl/
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] qv4l2: fix qt5 opengl runtime errors

2014-12-15 Thread Peter Seiderer
Fix the following two runtime errors with qt-5.3.2:

- QOpenGLFunctions created with non-current context
  Program received signal SIGSEGV, Segmentation fault.
 #0  0x762819f0 in QOpenGLContext::shareGroup() const () at 
/usr/lib64/libQt5Gui.so.5
 #1  0x764ff470 in  () at /usr/lib64/libQt5Gui.so.5
 #2  0x764ff64b in QOpenGLFunctions::initializeOpenGLFunctions() ()
 at /usr/lib64/libQt5Gui.so.5
 #3  0x770c2e29 in  () at /usr/lib64/libQt5OpenGL.so.5
 #4  0x770c2f7c in QGLFunctions::initializeGLFunctions(QGLContext 
const*) ()
 at /usr/lib64/libQt5OpenGL.so.5
 #5  0x0040fab7 in CaptureWinGLEngine::CaptureWinGLEngine() 
(this=0x7494f0)
 at ../qv4l2/capture-win-gl.cpp:149
 #6  0x0040f562 in CaptureWinGL::CaptureWinGL(ApplicationWindow*) 
(this=0x749420, aw=
 0x8bbda0) at ../qv4l2/capture-win-gl.cpp:28
 #7  0x0043c005 in ApplicationWindow::newCaptureWin() (this=0x8bbda0)
 at ../qv4l2/qv4l2.cpp:443
 #8  0x0043ab8e in ApplicationWindow::setDevice(QString const, bool) 
(this=0x8bbda0, device=..., rawOpen=false) at ../qv4l2/qv4l2.cpp:257
 #9  0x00444724 in main(int, char**) (argc=1, argv=0x7fffdcd8)
 at ../qv4l2/qv4l2.cpp:1774

   Solution: call QGLFunctions::initializeGLFunctions() later (in
   CaptureWinGLEngine::initializeGL()).

- Program received signal SIGSEGV, Segmentation fault.
 #0  0x770c8cc0 in QGLShaderProgram::release() () at 
/usr/lib64/libQt5OpenGL.so.5
 #1  0x0040fe0f in CaptureWinGLEngine::clearShader() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:241
 #2  0x0041016b in CaptureWinGLEngine::changeShader() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:353
 #3  0x004105db in CaptureWinGLEngine::paintGL() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:438
 #4  0x770bc2f4 in QGLWidget::glDraw() () at 
/usr/lib64/libQt5OpenGL.so.5
 #5  0x770b9229 in QGLWidget::paintEvent(QPaintEvent*) ()
 at /usr/lib64/libQt5OpenGL.so.5
 #6  0x769ec112 in QWidget::event(QEvent*) () at 
/usr/lib64/libQt5Widgets.so.5
 #7  0x769b0cfc in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #8  0x769b5c36 in QApplication::notify(QObject*, QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #9  0x75d0fb35 in QCoreApplication::notifyInternal(QObject*, QEvent*) 
()
 at /usr/lib64/libQt5Core.so.5
 #10 0x769e6b25 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion 
const, QPoint const, int, QPainter*, QWidgetBackingStore*) () at 
/usr/lib64/libQt5Widgets.so.5
 #11 0x769bd3a1 in QWidgetPrivate::repaint_sys(QRegion const) ()
 at /usr/lib64/libQt5Widgets.so.5
 #12 0x76a0b873 in  () at /usr/lib64/libQt5Widgets.so.5
 #13 0x769b0cfc in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #14 0x769b5c36 in QApplication::notify(QObject*, QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #15 0x75d0fb35 in QCoreApplication::notifyInternal(QObject*, QEvent*) 
()
 at /usr/lib64/libQt5Core.so.5
 #16 0x76244fe6 in 
QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
 () at /usr/lib64/libQt5Gui.so.5
 #17 0x76245b45 in 
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
 () at /usr/lib64/libQt5Gui.so.5
 #18 0x7622c5a8 in 
QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag)
 () at /usr/lib64/libQt5Gui.so.5
 #19 0x7fffeeb75f30 in  () at /usr/lib64/qt5/plugins/platforms/libqxcb.so
 #20 0x742b1a04 in g_main_context_dispatch () at 
/usr/lib64/libglib-2.0.so.0
 #21 0x742b1c48 in  () at /usr/lib64/libglib-2.0.so.0
 #22 0x742b1cec in g_main_context_iteration () at 
/usr/lib64/libglib-2.0.so.0
 #23 0x75d6689c in 
QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () 
at /usr/lib64/libQt5Core.so.5
 #24 0x75d0da4b in 
QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) ()
 at /usr/lib64/libQt5Core.so.5
 #25 0x75d150a6 in QCoreApplication::exec() () at 
/usr/lib64/libQt5Core.so.5
 #26 0x0044476d in main(int, char**) (argc=1, argv=0x7fffdcd8)
 at ../qv4l2/qv4l2.cpp:1777

  Solution: call QGLShaderProgram::release() only in case shader program
   is previously linked.

Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 utils/qv4l2/capture-win-gl.cpp | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index f229866..5122d09 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -146,7 +146,7 @@ CaptureWinGLEngine::CaptureWinGLEngine() :
m_mag_filter(GL_NEAREST),
m_min_filter(GL_NEAREST)
 {
-   m_glfunction.initializeGLFunctions(context

[PATCH v2 3/3] qv4l2: update qmake project file

2014-12-05 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
Changes v1 - v2:
  - fix out of tree qmake build (add PWD to library paths)
  - fix opengl support (qt4 only) and add disabling hint
---
 utils/qv4l2/qv4l2.pro | 46 ++
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro
index 7ab39cc..19a046a 100644
--- a/utils/qv4l2/qv4l2.pro
+++ b/utils/qv4l2/qv4l2.pro
@@ -1,14 +1,52 @@
 ##
-# Automatically generated by qmake (1.07a) Sat Jun 17 12:35:16 2006
+# qmake project file for qv4l2
 ##
 
 TEMPLATE = app
 INCLUDEPATH += . ../libv4l2util ../../lib/include ../../include
 CONFIG += debug
 
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+#
+# qt5: opengl support for disabled (will crash on startup)
+#
+# qt4: to disable opengl suppport comment out the following
+# line and the line '#define HAVE_QTGL 1' from ../../config.h
+lessThan(QT_MAJOR_VERSION, 5): QT += opengl
+
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-ctl/
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-compliance
+
 # Input
-HEADERS += qv4l2.h general-tab.h capture-win.h
-SOURCES += qv4l2.cpp general-tab.cpp ctrl-tab.cpp capture-win.cpp
-LIBS += -L../../lib/libv4l2 -lv4l2 -L../../lib/libv4lconvert -lv4lconvert -lrt 
-L../libv4l2util -lv4l2util -ldl -ljpeg
+HEADERS += alsa_stream.h
+HEADERS += capture-win-gl.h
+HEADERS += capture-win.h
+HEADERS += capture-win-qt.h
+HEADERS += general-tab.h
+HEADERS += qv4l2.h
+HEADERS += raw2sliced.h
+HEADERS += vbi-tab.h
+HEADERS += ../v4l2-ctl/vivid-tpg.h
+HEADERS += ../v4l2-ctl/vivid-tpg-colors.h
+HEADERS += ../../config.h
+
+SOURCES += capture-win.cpp
+SOURCES += capture-win-gl.cpp
+SOURCES += capture-win-qt.cpp
+SOURCES += ctrl-tab.cpp
+SOURCES += general-tab.cpp
+SOURCES += qv4l2.cpp
+SOURCES += raw2sliced.cpp
+SOURCES += tpg-tab.cpp
+SOURCES += vbi-tab.cpp
+SOURCES += ../v4l2-ctl/vivid-tpg.c
+SOURCES += ../v4l2-ctl/vivid-tpg-colors.c
+
+LIBS += -L$$PWD/../../lib/libv4l2 -lv4l2
+LIBS += -L$$PWD/../../lib/libv4lconvert -lv4lconvert
+LIBS += -L$$PWD/../libv4l2util -lv4l2util 
+LIBS += -lrt -ldl -ljpeg
 
 RESOURCES += qv4l2.qrc
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] configure.ac: add qt5 detection support

2014-12-05 Thread Peter Seiderer
Disable QTGL for qt5 because of qv4l2 crash on startup.

Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
Changes v1 - v2:
  - fix configure log output for qt5
  - fix qt4 detection
---
 configure.ac | 42 --
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7bf9bf6..588dd9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,29 +131,43 @@ AS_IF([test x$with_jpeg != xno],
 
 AM_CONDITIONAL([HAVE_JPEG], [$have_jpeg])
 
-PKG_CHECK_MODULES(QT, [QtCore = 4.4 QtGui = 4.4], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
+PKG_CHECK_MODULES(QT5, [Qt5Core = 5.0 Qt5Gui = 5.0 Qt5Widgets = 5.0], 
[qt_pkgconfig=true], [qt_pkgconfig=false])
 if test x$qt_pkgconfig = xtrue; then
+   QT_CFLAGS=$QT5_CFLAGS -fPIC
+   QT_LIBS=$QT5_LIBS
AC_SUBST(QT_CFLAGS)
AC_SUBST(QT_LIBS)
-   MOC=`$PKG_CONFIG --variable=moc_location QtCore`
-   UIC=`$PKG_CONFIG --variable=uic_location QtCore`
-   RCC=`$PKG_CONFIG --variable=rcc_location QtCore`
-   if test -z $RCC; then
-  RCC=rcc
-   fi
+   AC_CHECK_PROGS(MOC, [moc-qt5 moc])
+   AC_CHECK_PROGS(UIC, [uic-qt5 uic])
+   AC_CHECK_PROGS(RCC, [rcc-qt5 rcc])
AC_SUBST(MOC)
AC_SUBST(UIC)
AC_SUBST(RCC)
+# disable QTGL for qt5 because qv4l2 crash
+   qt_pkgconfig_gl=false
 else
-   AC_MSG_WARN(Qt4 or higher is not available)
+   PKG_CHECK_MODULES(QT, [QtCore = 4.0 QtGui = 4.0], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
+   if test x$qt_pkgconfig = xtrue; then
+  MOC=`$PKG_CONFIG --variable=moc_location QtCore`
+  UIC=`$PKG_CONFIG --variable=uic_location QtCore`
+  RCC=`$PKG_CONFIG --variable=rcc_location QtCore`
+  if test -z $RCC; then
+ RCC=rcc
+  fi
+  AC_SUBST(MOC)
+  AC_SUBST(UIC)
+  AC_SUBST(RCC)
+  PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
+  if test x$qt_pkgconfig_gl = xtrue; then
+ AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
+  else
+ AC_MSG_WARN(Qt4 OpenGL is not available)
+  fi
+   else
+  AC_MSG_WARN(Qt4 or higher is not available)
+   fi
 fi
 
-PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
-if test x$qt_pkgconfig_gl = xtrue; then
-   AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
-else
-   AC_MSG_WARN(Qt4 OpenGL or higher is not available)
-fi
 
 PKG_CHECK_MODULES(ALSA, [alsa], [alsa_pkgconfig=true], [alsa_pkgconfig=false])
 if test x$alsa_pkgconfig = xtrue; then
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] qv4l2: fix qt5 compile

2014-12-05 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 utils/qv4l2/capture-win-qt.cpp |  4 
 utils/qv4l2/qv4l2.cpp  | 21 +
 2 files changed, 25 insertions(+)

diff --git a/utils/qv4l2/capture-win-qt.cpp b/utils/qv4l2/capture-win-qt.cpp
index db85cd2..9c849a0 100644
--- a/utils/qv4l2/capture-win-qt.cpp
+++ b/utils/qv4l2/capture-win-qt.cpp
@@ -117,7 +117,11 @@ void CaptureWinQt::paintFrame()
 void CaptureWinQt::stop()
 {
if (m_data != NULL)
+#if QT_VERSION = 0x05
+   memcpy(m_image-bits(), m_data, m_image-byteCount());
+#else
memcpy(m_image-bits(), m_data, m_image-numBytes());
+#endif
m_data = NULL;
 }
 
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 0784a15..8329cbd 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -1084,8 +1084,13 @@ void ApplicationWindow::startAudio()
QString audOut = m_genTab-getAudioOutDevice();
 
if (audIn != NULL  audOut != NULL  audIn.compare(None)  
audIn.compare(audOut) != 0) {
+#if QT_VERSION = 0x05
+   alsa_thread_startup(audOut.toLatin1().data(), 
audIn.toLatin1().data(),
+   m_genTab-getAudioDeviceBufferSize(), NULL, 
0);
+#else
alsa_thread_startup(audOut.toAscii().data(), 
audIn.toAscii().data(),
m_genTab-getAudioDeviceBufferSize(), NULL, 
0);
+#endif
 
if (m_genTab-isRadio())
statusBar()-showMessage(Capturing audio);
@@ -1582,7 +1587,11 @@ void ApplicationWindow::error(const QString error)
 {
statusBar()-showMessage(error, 2);
if (!error.isEmpty())
+#if QT_VERSION = 0x05
+   fprintf(stderr, %s\n, error.toLatin1().data());
+#else
fprintf(stderr, %s\n, error.toAscii().data());
+#endif
 }
 
 void ApplicationWindow::error(int err)
@@ -1657,7 +1666,11 @@ static bool processShortOption(const QStringList args, 
int i, QString dev)
return false;
if (args[i].length() == 2) {
if (i + 1 = args.size()) {
+#if QT_VERSION = 0x05
+   usageError(args[i].toLatin1());
+#else
usageError(args[i].toAscii());
+#endif
return false;
}
dev = args[++i];
@@ -1680,7 +1693,11 @@ static bool processLongOption(const QStringList args, 
int i, QString dev)
return true;
}
if (i + 1 = args.size()) {
+#if QT_VERSION = 0x05
+   usageError(args[i].toLatin1());
+#else
usageError(args[i].toAscii());
+#endif
return false;
}
dev = args[++i];
@@ -1734,7 +1751,11 @@ int main(int argc, char **argv)
} else if (args[i] == -R || args[i] == --raw) {
raw = true;
} else {
+#if QT_VERSION = 0x05
+   printf(Invalid argument %s\n, 
args[i].toLatin1().data());
+#else
printf(Invalid argument %s\n, 
args[i].toAscii().data());
+#endif
return 0;
}
}
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] configure.ac: add qt5 detection support

2014-12-04 Thread Peter Seiderer
Disable QTGL for qt5 because of qv4l2 crash on startup.

Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 configure.ac | 41 +++--
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7bf9bf6..245a409 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,29 +131,42 @@ AS_IF([test x$with_jpeg != xno],
 
 AM_CONDITIONAL([HAVE_JPEG], [$have_jpeg])
 
-PKG_CHECK_MODULES(QT, [QtCore = 4.4 QtGui = 4.4], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
+PKG_CHECK_MODULES(QT, [Qt5Core = 5.0 Qt5Gui = 5.0 Qt5Widgets = 5.0], 
[qt_pkgconfig=true], [qt_pkgconfig=false])
 if test x$qt_pkgconfig = xtrue; then
+   QT_CFLAGS=$QT_CFLAGS -fPIC
AC_SUBST(QT_CFLAGS)
AC_SUBST(QT_LIBS)
-   MOC=`$PKG_CONFIG --variable=moc_location QtCore`
-   UIC=`$PKG_CONFIG --variable=uic_location QtCore`
-   RCC=`$PKG_CONFIG --variable=rcc_location QtCore`
-   if test -z $RCC; then
-  RCC=rcc
-   fi
+   AC_CHECK_PROGS(MOC, [moc-qt5 moc])
+   AC_CHECK_PROGS(UIC, [uic-qt5 uic])
+   AC_CHECK_PROGS(RCC, [rcc-qt5 rcc])
AC_SUBST(MOC)
AC_SUBST(UIC)
AC_SUBST(RCC)
+# disable QTGL for qt5 because qv4l2 crash
+   qt_pkgconfig_gl=false
 else
-   AC_MSG_WARN(Qt4 or higher is not available)
+   PKG_CHECK_MODULES(QT, [QtCore = 4.0 QtGui = 4.0], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
+   if test x$qt_pkgconfig = xtrue; then
+  MOC=`$PKG_CONFIG --variable=moc_location Qt5Core`
+  UIC=`$PKG_CONFIG --variable=uic_location Qt5Core`
+  RCC=`$PKG_CONFIG --variable=rcc_location Qt5Core`
+  if test -z $RCC; then
+ RCC=rcc
+  fi
+  AC_SUBST(MOC)
+  AC_SUBST(UIC)
+  AC_SUBST(RCC)
+  PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
+  if test x$qt_pkgconfig_gl = xtrue; then
+ AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
+  else
+ AC_MSG_WARN(Qt4 OpenGL is not available)
+  fi
+   else
+  AC_MSG_WARN(Qt4 or higher is not available)
+   fi
 fi
 
-PKG_CHECK_MODULES(QTGL, [QtOpenGL = 4.8 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
-if test x$qt_pkgconfig_gl = xtrue; then
-   AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
-else
-   AC_MSG_WARN(Qt4 OpenGL or higher is not available)
-fi
 
 PKG_CHECK_MODULES(ALSA, [alsa], [alsa_pkgconfig=true], [alsa_pkgconfig=false])
 if test x$alsa_pkgconfig = xtrue; then
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] qv4l2: fix qt5 compile

2014-12-04 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 utils/qv4l2/capture-win-qt.cpp |  4 
 utils/qv4l2/qv4l2.cpp  | 21 +
 2 files changed, 25 insertions(+)

diff --git a/utils/qv4l2/capture-win-qt.cpp b/utils/qv4l2/capture-win-qt.cpp
index db85cd2..9c849a0 100644
--- a/utils/qv4l2/capture-win-qt.cpp
+++ b/utils/qv4l2/capture-win-qt.cpp
@@ -117,7 +117,11 @@ void CaptureWinQt::paintFrame()
 void CaptureWinQt::stop()
 {
if (m_data != NULL)
+#if QT_VERSION = 0x05
+   memcpy(m_image-bits(), m_data, m_image-byteCount());
+#else
memcpy(m_image-bits(), m_data, m_image-numBytes());
+#endif
m_data = NULL;
 }
 
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 0784a15..8329cbd 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -1084,8 +1084,13 @@ void ApplicationWindow::startAudio()
QString audOut = m_genTab-getAudioOutDevice();
 
if (audIn != NULL  audOut != NULL  audIn.compare(None)  
audIn.compare(audOut) != 0) {
+#if QT_VERSION = 0x05
+   alsa_thread_startup(audOut.toLatin1().data(), 
audIn.toLatin1().data(),
+   m_genTab-getAudioDeviceBufferSize(), NULL, 
0);
+#else
alsa_thread_startup(audOut.toAscii().data(), 
audIn.toAscii().data(),
m_genTab-getAudioDeviceBufferSize(), NULL, 
0);
+#endif
 
if (m_genTab-isRadio())
statusBar()-showMessage(Capturing audio);
@@ -1582,7 +1587,11 @@ void ApplicationWindow::error(const QString error)
 {
statusBar()-showMessage(error, 2);
if (!error.isEmpty())
+#if QT_VERSION = 0x05
+   fprintf(stderr, %s\n, error.toLatin1().data());
+#else
fprintf(stderr, %s\n, error.toAscii().data());
+#endif
 }
 
 void ApplicationWindow::error(int err)
@@ -1657,7 +1666,11 @@ static bool processShortOption(const QStringList args, 
int i, QString dev)
return false;
if (args[i].length() == 2) {
if (i + 1 = args.size()) {
+#if QT_VERSION = 0x05
+   usageError(args[i].toLatin1());
+#else
usageError(args[i].toAscii());
+#endif
return false;
}
dev = args[++i];
@@ -1680,7 +1693,11 @@ static bool processLongOption(const QStringList args, 
int i, QString dev)
return true;
}
if (i + 1 = args.size()) {
+#if QT_VERSION = 0x05
+   usageError(args[i].toLatin1());
+#else
usageError(args[i].toAscii());
+#endif
return false;
}
dev = args[++i];
@@ -1734,7 +1751,11 @@ int main(int argc, char **argv)
} else if (args[i] == -R || args[i] == --raw) {
raw = true;
} else {
+#if QT_VERSION = 0x05
+   printf(Invalid argument %s\n, 
args[i].toLatin1().data());
+#else
printf(Invalid argument %s\n, 
args[i].toAscii().data());
+#endif
return 0;
}
}
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] qv4l2: update qmake project file

2014-12-04 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 utils/qv4l2/qv4l2.pro | 32 ++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro
index 7ab39cc..2c6c9c8 100644
--- a/utils/qv4l2/qv4l2.pro
+++ b/utils/qv4l2/qv4l2.pro
@@ -6,9 +6,37 @@ TEMPLATE = app
 INCLUDEPATH += . ../libv4l2util ../../lib/include ../../include
 CONFIG += debug
 
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+greaterThan(QT_MAJOR_VERSION, 4): QT += opengl
+
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-ctl/
+INCLUDEPATH += /home/seiderer/Work/v4l_utils/v4l-utils/utils/v4l2-compliance
+
 # Input
-HEADERS += qv4l2.h general-tab.h capture-win.h
-SOURCES += qv4l2.cpp general-tab.cpp ctrl-tab.cpp capture-win.cpp
+HEADERS += alsa_stream.h
+HEADERS += capture-win-gl.h
+HEADERS += capture-win.h
+HEADERS += capture-win-qt.h
+HEADERS += general-tab.h
+HEADERS += qv4l2.h
+HEADERS += raw2sliced.h
+HEADERS += vbi-tab.h
+HEADERS += ../v4l2-ctl/vivid-tpg.h
+HEADERS += ../v4l2-ctl/vivid-tpg-colors.h
+
+SOURCES += capture-win.cpp
+SOURCES += capture-win-gl.cpp
+SOURCES += capture-win-qt.cpp
+SOURCES += ctrl-tab.cpp
+SOURCES += general-tab.cpp
+SOURCES += qv4l2.cpp
+SOURCES += raw2sliced.cpp
+SOURCES += tpg-tab.cpp
+SOURCES += vbi-tab.cpp
+SOURCES += ../v4l2-ctl/vivid-tpg.c
+SOURCES += ../v4l2-ctl/vivid-tpg-colors.c
+
 LIBS += -L../../lib/libv4l2 -lv4l2 -L../../lib/libv4lconvert -lv4lconvert -lrt 
-L../libv4l2util -lv4l2util -ldl -ljpeg
 
 RESOURCES += qv4l2.qrc
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using the coda driver with Gstreamer

2014-11-18 Thread Peter Seiderer
Hello Fabio,

maybe trying to increase the following kernel option helps (for the v4l2 kernel
driver failure message, not for the followup gstraemer errors):

CONFIG_CMA_SIZE_MBYTES=256

Regards,
Peter
---
Sorry for loosing the CC list, reading the mailing list by web browser...

 Hi,

 I am running linux-next 20141117 on a mx6qsabresd board and trying to
 play a mp4 video via Gstreamer 1.4.1, but I am getting the following
 error:

 root@imx6qsabresd:/mnt/nfs# gst-play-1.0 sample.mp4
 Volume: 100%
 Now playing /mnt/nfs/sample.mp4
 [  506.983809] [ cut here ]
 [  506.988522] WARNING: CPU: 0 PID: 954 at
 drivers/media/v4l2-core/videobuf2-core.c:1781
 vb2_start_streaming+0xc4/0x160()
 [  506.999301] Modules linked in:
 [  507.002489] CPU: 0 PID: 954 Comm: multiqueue0:src Tainted: G
 W  3.18.0-rc4-next-20141117-dirty #2044
 [  507.012660] Backtrace:
 [  507.015253] [80011f44] (dump_backtrace) from [800120e0]
 (show_stack+0x18/0x1c)
 [  507.022891]  r6:06f5 r5: r4: r3:
 [  507.028707] [800120c8] (show_stack) from [806b730c]
 (dump_stack+0x88/0xa4)
 [  507.035954] [806b7284] (dump_stack) from [8002a4dc]
 (warn_slowpath_common+0x80/0xbc)
 [  507.044135]  r5:804a80a8 r4:
 [  507.047802] [8002a45c] (warn_slowpath_common) from [8002a53c]
 (warn_slowpath_null+0x24/0x2c)
 [  507.056605]  r8: r7:bd71c640 r6:bd614ef0 r5:bd614ee0 r4:ffea
 [  507.063470] [8002a518] (warn_slowpath_null) from [804a80a8]
 (vb2_start_streaming+0xc4/0x160)
 [  507.072293] [804a7fe4] (vb2_start_streaming) from [804a9efc]
 (vb2_internal_streamon+0xfc/0x158)
 [  507.081385]  r7:bd71c640 r6:bd6c29ec r5:bd614c00 r4:bd614de0
 [  507.087133] [804a9e00] (vb2_internal_streamon) from [804ab0a8]
 (vb2_streamon+0x34/0x58)
 [  507.095567]  r5:bd614c00 r4:0002
 [  507.099231] [804ab074] (vb2_streamon) from [804a3b10]
 (v4l2_m2m_streamon+0x28/0x40)
 [  507.107287] [804a3ae8] (v4l2_m2m_streamon) from [804a3b40]
 (v4l2_m2m_ioctl_streamon+0x18/0x1c)
 [  507.116292]  r5:bd9083c8 r4:40045612
 [  507.120016] [804a3b28] (v4l2_m2m_ioctl_streamon) from
 [80492e48] (v4l_streamon+0x20/0x24)
 [  507.128693] [80492e28] (v4l_streamon) from [80494dc4]
 (__video_do_ioctl+0x24c/0x2e0)
 [  507.136826] [80494b78] (__video_do_ioctl) from [804953a8]
 (video_usercopy+0x118/0x480)
 [  507.145133]  r10:0001 r9:bd6cbe10 r8:74a1164c r7:
 r6: r5:80494b78
 [  507.153073]  r4:40045612
 [  507.155632] [80495290] (video_usercopy) from [80495724]
 (video_ioctl2+0x14/0x1c)
 [  507.163408]  r10:bd8fccb8 r9:74a1164c r8:bd909064 r7:74a1164c
 r6:40045612 r5:bd71c640
 [  507.171343]  r4:bd9083c8
 [  507.173902] [80495710] (video_ioctl2) from [804918f8]
 (v4l2_ioctl+0x104/0x14c)
 [  507.181512] [804917f4] (v4l2_ioctl) from [800fc944]
 (do_vfs_ioctl+0x80/0x634)
 [  507.189019]  r8:0009 r7:74a1164c r6:0009 r5:800fcf34
 r4:bd71c640 r3:804917f4
 [  507.196870] [800fc8c4] (do_vfs_ioctl) from [800fcf34]
 (SyS_ioctl+0x3c/0x60)
 [  507.204203]  r10: r9:bd6ca000 r8:0009 r7:74a1164c
 r6:40045612 r5:bd71c640
 [  507.212159]  r4:bd71c641
 [  507.214722] [800fcef8] (SyS_ioctl) from [8000ec60]
 (ret_fast_syscall+0x0/0x48)
 [  507.222311]  r8:8000ee24 r7:0036 r6:73c183a0 r5:754248e0
 r4: r3:
 [  507.230168] ---[ end trace c3703a604edaf0d0 ]---
 ERROR Failed to connect to X display server for file:///mnt/nfs/sample.mp4
 ERROR debug information:
 /code/yocto/dizzy/build/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/gstreamer1.0-plugins-bad/1.4.1-r0/gst-plugins-bad-1.4.1/ext/gl/gstglimagesink.c(453):
 _ensure_gl_setup ():
 /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:vbin/GstGLImageSink:glimagesink0
 GLib (gthread-posix.c): Unexpected error from C library during
 'pthread_mutex_lock': Invalid argument.  Aborting.
 Aborted

 Any suggestions?

 Thanks,

 Fabio Estevam

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html